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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

DAX Calculate SUM of Conditional multiple columns

I am looking for DAX for the below condition where get the SUM of Count for each individual TestName and Success column for that individual date.

 

PassCount =
If [TestName] = "XMods And More", [Success] = "TRUE" then get SUM of Count
elseIf [TestName] = "IQA", [Success] = "TRUE" then get SUM of count
etc..

 

skuruvatti_1-1651187716167.png

 

 

1 ACCEPTED SOLUTION

I was thinking in terms of a calculated column.

 

Since you're doing this as a measure, I think it can be simpler:

CALCULATE ( SUM ( Table1[Count] ), Table1[Success] = "TRUE" )

View solution in original post

10 REPLIES 10
AlexisOlson
Super User
Super User

How about this?

PassCount =
CALCULATE (
    SUM ( Table1[Count] ),
    ALLEXCEPT ( Table1, Table1[TestName], Table1[Timestamp] ),
    Table1[Success] = "TRUE"
)

 

The logic is pretty much the same as this:

PassCount =
SUMX (
    FILTER (
        ALL ( Table1 ),
        Table1[Success] = "TRUE"
            && Table1[TestName]  = EARLIER ( Table1[TestName]  )
            && Table1[Timestamp] = EARLIER ( Table1[Timestamp] )
    ),
    Table1[Count]
)
Anonymous
Not applicable

Ok, I tried! but somehow the calculation is messing with me. I need to get the percentage and realized I have one category for each day so skipped the Timestamp.

 

FailureCount = CALCULATESUM ( AvailabilityResults[Count] ),ALLEXCEPT ( AvailabilityResults, AvailabilityResults[TestName]), AvailabilityResults[Success] ="FALSE")
 
PassCount= CALCULATE ( SUM ( AvailabilityResults[Count] ),ALLEXCEPT ( AvailabilityResults, AvailabilityResults[TestName]), AvailabilityResults[Success] ="TRUE")
 
Percentage= 
DIVIDE([Passcount], ([Passcount] + [FailureCount]))
 
Ex: TestName = IQA, Coverage,  I have only PassCount = 85 for today and I am expecting 100% but it is 99.97%/99.86%
skuruvatti_0-1651259726352.pngskuruvatti_1-1651259760854.png

 

I certainly wouldn't expect it to work if you remove [TimeStamp] from the measure.

Anonymous
Not applicable

okay, I added Timestamp, and it' same. I see that it's counting all FALSE values regardless of the TestName category. 

 

I need to count for each TestName and Success, 

 

 

 

Can you share some example data in a format that can be copied and pasted from? Please include the result you expect to match as well.

 

https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...

Anonymous
Not applicable

Here is the table and I am looking for a table matrix for each individual day.

 

% percentage = 

DIVIDE([Passcount], ([Passcount] + [FailureCount]))

 

Test Name% pecentage 
iqa97.7%
coverageweb-healthcheck100%
XMods And More99.53%

 

TimeStampTestNamemessageSuccessCount
Friday, April 29, 2022coverageweb-healthcheckPassedTRUE85
Friday, April 29, 2022XMods And MorePassedTRUE212
Friday, April 29, 2022XMods And MoreHTTP status: 500; response code: 2; response message: There has been a system error.FALSE1
Friday, April 29, 2022iqaPassedTRUE85
Friday, April 29, 2022iqaHTTP ErrorFALSE2
Thursday, April 28, 2022XMods And MoreHTTP status: 500; response code: 2; response message: There has been a system error.FALSE1
Thursday, April 28, 2022coverageweb-healthcheckPassedTRUE288
Thursday, April 28, 2022iqaPassedTRUE288
Thursday, April 28, 2022XMods And MorePassedTRUE719

Yeah, those are the numbers I get too. I'm not sure what the error is.

 

AlexisOlson_0-1651506318544.png

Anonymous
Not applicable

oh my bad! I am using a table instead of a matrix and don't want to show Timestamp, so I did a relation with the date table separately and applied ISToday = Yes on the filter, and this is what I get.

skuruvatti_1-1651511119009.png

 

 

skuruvatti_0-1651511030676.png

 

I was thinking in terms of a calculated column.

 

Since you're doing this as a measure, I think it can be simpler:

CALCULATE ( SUM ( Table1[Count] ), Table1[Success] = "TRUE" )
Anonymous
Not applicable

yes, it worked! Thanks for your time.

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors