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

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

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Users online (2,349)