Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
I am trying to wrap my head around why the following measure works the way I want it to, but not the way I would expect or can explain:
COUNTROWS(CALCULATETABLE(ClientInfo,ClientInfo[Client Number] <> VALUES(ClientInfo[Client Number])))
The context is that if I remove the line "ClientInfo[Client Number] <> VALUES(ClientInfo[Client Number])", I get the total number of rows in the ClientInfo table - lets say 100. When I add the line back to the measure and view the count without any slicers/filters within a report, I get an error because no single client is selected - that makes sense. If I select a single client number (ClientInfo[Client Number]) from a slicer/filter, I get a count of 99. However, If I then use another attribute of the ClientInfo table, for example "State," I get a row count that is equal to the number of clients within that state minus 1. With those same slicers in place (single client and single state selected) If I again redefine the measure and take out the "ClientInfo[Client Number] <> VALUES(ClientInfo[Client Number])" line, I get 1 - the measure would read: COUNTROWS(CALCULATETABLE(ClientInfo)).
I'm not sure why the measure as defined at the top of this post correctly returns the number of clients within a state, minus 1, when I select a single client and state. I have a theory as to why this works, but I should actually just call it a wild guess. Can anyone explain why this works the way it does?
Thanks,
Eric
Solved! Go to Solution.
Having slept on it, I'm now wondering to myself why I didn't understand this. By leaving the "ClientInfo[Client Number] <> VALUES(ClientInfo[Client Number])" line in the measure, I'm resetting the filter on ClientInfo[ClientNumber] and getting a count of the rows where other slicer values are limiting the number of clients minus the currently selected client.
Sleep...is there anything it can't do? (Said in your best Homer Simpson voice.)
Eric
Having slept on it, I'm now wondering to myself why I didn't understand this. By leaving the "ClientInfo[Client Number] <> VALUES(ClientInfo[Client Number])" line in the measure, I'm resetting the filter on ClientInfo[ClientNumber] and getting a count of the rows where other slicer values are limiting the number of clients minus the currently selected client.
Sleep...is there anything it can't do? (Said in your best Homer Simpson voice.)
Eric
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
95 | |
86 | |
78 | |
66 |
User | Count |
---|---|
150 | |
118 | |
111 | |
106 | |
95 |