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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculate SUM from a calculated measure

Hi,

I am using the measure below to get output as 0 & 1 and now from this output i need to calculate the sum of 0's & 1's.
from a  measure we cant create a SUM right. 
What is the alternative to get sum of 0 & 1 from the Below measure, Any suggestions please?

measure = 

VAR _dCount =
    COUNTROWS (
        FILTER (
            ALL ( 'DB 15092022_1' ),
            'DB 15092022_1'[STO Number] = SELECTEDVALUE ( 'DB 15092022_1'[STO Number] )
                && 'DB 15092022_1'[Index] <= SELECTEDVALUE ( 'DB 15092022_1'[Index] )
        )
    )
RETURN
    IF ( _dCount > 1, 0, 1 )

Thanks
3 REPLIES 3
Anonymous
Not applicable

Hi

I am using the measure below to get output as 0 & 1 and now from this output i need to calculate the sum of 0's & 1's.
from a  measure we cant create a SUM right. 
What is the alternative to get sum of 0 & 1 from the Below measure, Any suggestions please?

measure = 

VAR _dCount =
    COUNTROWS (
        FILTER (
            ALL ( 'DB 15092022_1' ),
            'DB 15092022_1'[STO Number] = SELECTEDVALUE ( 'DB 15092022_1'[STO Number] )
                && 'DB 15092022_1'[Index] <= SELECTEDVALUE ( 'DB 15092022_1'[Index] )
        )
    )
RETURN
    IF ( _dCount > 101 )

Thanks
Greg_Deckler
Community Champion
Community Champion

@Anonymous This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg

Thanks for the quick response.
Here i need to do SUM of the 0's & 1's. Grouping is not  required
any help please?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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