I have a data table of how many passengers get on and off a bus. It records which section they got on and which one they got off. My table looks like this:
SectionIn SectionOut Pax
--------------------------
1 1 1
1 1 2
1 3 3
1 1 1
1 3 5
...etc...
With this data, I created a matrix with SectionIn
on rows, SectionOut
on columns, and the sum of Pax
as the value.
First (and most important) I need to count how many instances you have in the matrix. That is, how many cells in the matrix have a value. In this case, I have 15 instances (1+2+3+4+5 values in the upper triangle). In Excel, it is easy with the COUNT
formula (check the file please), but not dynamic.
Then, I need to calculate % of the grand total with filters and no filters (I think we have to considerate the evaluation context here). This are less important because they depend on the magic counting measure above.
Here you can find a sample database with a pivot table and the target I'm looking for. I created the target with Excel formulas but I need that in DAX so I can dynamically filter the pivot table and get the result in another pivot table.
Sample test: https://drive.google.com/file/d/1xtNdM7g8lWHvqF8UX4K3TP0uOp-fFIZ5/view?usp=sharing
I found easier using examples in that file than explaining with words what I need (hopefully you too), but if you don't understand please don't hesitate asking anything.
Thank very much in advance!
Regards,
Andy