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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ravimerugu
Frequent Visitor

How to get row count as a scalar value in a measure

I have a visual that shows percentage of shoppers who rated individual brands above a certain rating number. To caluclate the percentage, I need to find the total number of shoppers at the brand level as a category. I am using the following query. It does give me the required total value on its own, but is drills down to each brand when I put it in the table (shown below). From the table shown, the brands, Maserati, Alfa Romeo, and Fisker show incorrect total value. It should the 228333. This is messing up my percentage calculations. What do I have to do to get a scalar value?

 

Total Shopper Count =
CALCULATE (
DISTINCTCOUNT ( 'Rating Table'[Shopper Id] ),
ALL ( 'Rating Table'[Rating Number] ),
'Rating Table'[Marketing Insight Attribute Name] = "Brand"
)

 

Capture1.PNGCapture2.PNG

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @ravimerugu

 

I think I see what you are trying to do.

 

Try this variation and see if this helps

 

Total Shopper Count = 
CALCULATE (
DISTINCTCOUNT ( 'Rating Table'[Shopper Id] ),
ALLEXCEPT( 'Rating Table','Rating Table'[Marketing Insight Attribute Name] ),
'Rating Table'[Marketing Insight Attribute Name] = "Brand"
)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Phil_Seamark
Microsoft Employee
Microsoft Employee

HI @ravimerugu

 

I think I see what you are trying to do.

 

Try this variation and see if this helps

 

Total Shopper Count = 
CALCULATE (
DISTINCTCOUNT ( 'Rating Table'[Shopper Id] ),
ALLEXCEPT( 'Rating Table','Rating Table'[Marketing Insight Attribute Name] ),
'Rating Table'[Marketing Insight Attribute Name] = "Brand"
)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thanks so much, Phil! That did the trick!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.