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
Dayna
Helper V
Helper V

Sum / Count of Measure Value

Hello,

 

Ultimately, I want a count of servers where a record in a related table doesn't exist. So far, I've done the inverse, I calculate if we've done a test with the following:

CountOfSystemsTestedALL = 
CALCULATE (
    DISTINCTCOUNT ( 'DR Server'[Id] ),
    FILTER ( 'DR TestingLog', 'DR TestingLog'[TestDate] <> BLANK () ), FILTER(ALLSELECTED('DR Server'), 'DR Server'[ServerStatus] = "LIVE")
)

Then I work out the opposite:

NotTestedFlag = if([CountOfSystemsTestedALL]=1,0,1)

This basically gives me a value of 1 against all servers where we haven't tested it. All OK so far..

 

What I want, feels really basic, is a sum / count of these records. i.e. if there's 20 servers where the NotTestedFlag is 1, I want to sum and get a value of 20. Everything I do doesn't seem to work!

 

Many thanks for your help!

 

Kind Regards,

Dayna

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Dayna 

 

Is it maybe possible to do something like below?

 

Sum of tested servers =
SUMX (
    SUMMARIZE ( 'DR Server', 'DR Server'[Id], "Value", [NotTestedFlag] ),
    [Value]
)

Pct tested = [Sum of tested servers] / DISTINCTCOUNT('DR Server'[Id])

The summarize should return a list where your measure [NotTestedFlag] is calculated for each server ID and then it is summed by the SUMX.

I'm assuming that the denomiator your %-measure is the number of servers.

 

If this works then please mark it as the accepted solution.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Dayna 

 

Is it maybe possible to do something like below?

 

Sum of tested servers =
SUMX (
    SUMMARIZE ( 'DR Server', 'DR Server'[Id], "Value", [NotTestedFlag] ),
    [Value]
)

Pct tested = [Sum of tested servers] / DISTINCTCOUNT('DR Server'[Id])

The summarize should return a list where your measure [NotTestedFlag] is calculated for each server ID and then it is summed by the SUMX.

I'm assuming that the denomiator your %-measure is the number of servers.

 

If this works then please mark it as the accepted solution.

Anonymous
Not applicable

You're welcome.

 

If you have tried to use DAX studio then you can see the table which summarize creates by writing the following:

EVALUATE
SUMMARIZE ( 'DR Server', 'DR Server'[Id], "Value", [NotTestedFlag] )

The "Value" can be though of as a calculated column containing the measure NotTestedFlag, whereas [Value] is refering to this exact column.

The measure is therefore the sum of a calculated column in a flexible table.

 

That seemed to work! Thank you! Can you explain to me how the "value" and [value] works in that, please?

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.