Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
etheil
Helper I
Helper I

CALCULATETABLE Question

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

1 ACCEPTED SOLUTION
etheil
Helper I
Helper I

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

View solution in original post

1 REPLY 1
etheil
Helper I
Helper I

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.