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
joebc
Frequent Visitor

summarizing the results of a measure

Hi all, Still pretty new to DAX, but I think i just need a little help to take this one step further... I'm actually working in Power Pivot here though fyi... I've got a measure that evaluates to True or False for all the records in my table.  What i'd like to do now, is to get a count of the results (how many True and False), summarized or filtered by a distinct category rather than each record... following the advice from https://community.powerbi.com/t5/Desktop/Is-it-possible-to-count-the-result-of-a-measure/m-p/520128#... i can get the counts for each record, but I can't figure out how to filter or summarize to get the counts by category...

 

Here's a simple example of my data and desired results...

 

Data

CategoryTypeTransaction IDPrice/lbGreater than $1
AppleGreen1$1.25TRUE
AppleGreen2$1.35TRUE
AppleGreen3$1.10TRUE
AppleGreen4$1.40TRUE
AppleRed5$0.98FALSE
AppleRed6$1.10TRUE
AppleRed7$0.85FALSE
AppleRed8$0.99FALSE
OrangeTangerine9$1.35TRUE
OrangeTangerine10$0.95FALSE

 

Current measure evaluates Median by category: =Median[Price/lb] resulting effectively in something like this in my pivot table...

 

CategoryMedian $Greater Than $1
Apple$1.10TRUE
Orange$1.15TRUE

 

The Desired Result is a table like this based on the category results above:

ResultsCount
TRUE2
FALSE0

 

so if my measure to calculate True or False is called [dollar] and my table is called 'Fruit', i feel like i should be able to use some combination of Filter, distinct, countrows or summarize, but so far I'm failing to find the right combination.

 

maybe something like =FILTER(DISTINCT('Fruit'[Category],COUNTROWS('Fruit'[dollar]=TRUE)))?

That doesn't work, but you get the idea... Can anyone point me in the right direction?

 

Thanks!

 

1 REPLY 1
avanderschilden
Resolver I
Resolver I

Hi Joe,

 

It looks like you want to use TRUE/FALSE as labels and this is probably not going to work with a measure, since a measure produces a scalar value.

You could create a calculated column in the table that assigns TRUE/FALSE to each row, and use that column as labels in your table.

 

After that you can create a simple measure like COUNTROWS(Fruit) and place it in the table.

Capture.PNG

Let me know what you think about it.

 

Regards,

 

Adrian

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.

Top Solution Authors