In my fact table I have one column which indicates the time difference between two datetime values in integer minutes. I have also created a group (by left-clicking on the [Difference_min] column in the dashboard view and selecting new group) to better display the difference in time intervals. In the table view it looks like this:
I use a simple measure to count the number of rows in my Data table and present it as % of total to see the distribution of time differences based on the interval grouping:
NumberOfRows = COUNTROWS('Data')
First I remove the blank values (Tom) by adding a the [Difference_min] column as a slicer and select all values except the blank value.
Then I want to only look at the percentage of the two highest time difference groups. I duplicate my histogram and in the visual slicer pane I select only 30 - 39
and 40+
, then I write a proper percentage measure like this and add it to the new visual:
NumberOfRows_pct =
DIVIDE(
[NumberOfRows];
CALCULATE(
[NumberOfRows];
ALL('Data'[Difference_min (group)])
);
0
)
I end up with this (green = only countrow function, black = divide function):
The green bars are correct (or at least what I expect to see), though I would have expected the black to have the same value as in the previous diagram, i.e. 7.5 % and 4.8 % respectively.
However, if I remove the filtering on [Difference_min] the NumberOfRows_pct measure behaves as I would expect:
Question
Why does the filtering/slicing on [Difference_min] cancel the effect of theALL('Data'[Difference_min (group)])
in the percentage measure?
Pbi example file: pbi file