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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
bibo
Frequent Visitor

Calculate the result of a measure

Hi , 

 

I am trying to count the result of a measure that i have created from a table ,

 

The table shows maintenance activity of different tools with a lot of maintenance notifications activities in the last two years.

 

i created a measure to indicate the equipment status whether it is in Repair or Pending Upgrade or Ready .

 

The table shows Maintenance Activity Versus Equipment Number and if the Notification is completed or not , Note : Same Equipment Number can have multiple maintenance activities

 

i used the following measure ;

 

IF(CALCULATE(COUNTBLANK('Maintenance Notifications'[Completion date]),'Maintenance Notifications'[Notification Type]="Failure")>0,"Repair",IF(CALCULATE(COUNTBLANK('Maintenance Notifications'[Completion date]),'Maintenance Notifications'[Notification Type]="Upgrade")>0,"Pending Upgrade","READY"))
 
it works fine to show the status of the tool when i put it in a table visualization but next step i am trying to calculate how many tools are Ready , in Repair and Pending Upgrade . I tried different ways to Count the result of the measure without any luck .
 
i appreciate your help and feedback .
7 REPLIES 7
Anonymous
Not applicable

Hi @bibo 

I build a table like yours to have a test.

Maintenance Notifications Table:

1.png

Firstly I use your measure to get a similar table visual like yours

2.png

Then I build three measures to achieve your goal

 

 

Upgrade = 
CALCULATE (
    COUNTROWS ( 'Maintenance Notifications' ),
        'Maintenance Notifications'[Notification Type] = "Upgrade"
)
Failure = 
CALCULATE (
    COUNTROWS ( 'Maintenance Notifications' ),
        'Maintenance Notifications'[Notification Type] = "Failure"
)
Color Value = 
SWITCH ( [Statue], "READY", 0, "Pending Upgrade", 1, "Repair", 2 )

 

 

Then I build another table visual

3.png

Use Icon in Conditional formatting

4.png

Result

5.png

You can download the pbix file from this link:Case_Calculate the result of a measure.pbix 

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

@

 

Thanks a lot for the reply and the Effort . 

 

i downloaded the file but when i use the measure "Upgrade" to count rows in the table , it will give number 6 based on the counting in " Notification Type " and  i am not able to create a measure to count the status in the "Statue" since it's a measure

 

if i created a column in the table to give me the same value of 'Statue' measure , you will end up having a tools like tool #5 appears in two counts ( Ready and Pending Upgrade ) and the reality that it has to be counted only in the "Pending Upgrade" and cannot be considered to be ready .

 

capture12.JPG

 

for the tools in Upgrade state; it's two based on the table below . and that's what i am trying to achieve to have the number of tools in Upgrade , Repair and Ready

 

 

Capture11.JPG

Greg_Deckler
Community Champion
Community Champion

@bibo - 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.

 

Obviously COUNTX would also work. Bottom line, create your table, use one of the "X" aggregation functions to iterate over it. 

 

Also, seems like you might like my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...

 

Also, if you are looking at seeing status by intervals, this might help as well. 
https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364



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...

Hello @Greg_Deckler  , Thanks for the reply . I tried to follow the steps but still was not successful .

 

Note : Thanks a lot for pointing out to the MTBF article , it's very useful .

amitchandak
Super User
Super User

@bibo ,Can you share sample data and sample output in table format?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak , 

 

here is a sample of the data that i use to build my visualizations ;

Picture1.jpg

 

I used to build the following Visual using the Equation that i mentioned in my previous post , Please note that some of the Equipment can have more than one maintenance notifications ( some of them are completed while others can be opened )

 

 

Capture.JPG

 

I am trying to ;

 

1. Build a visualization to show how many tools in Green " READY " , Red " REPAIR" , Yellow " Pending Upgrade"
2. Having a slicer to filter the tools in the visaulization based on the status .

 

 

Hi,

Based on the sample data that you have shared, show the expected result.  Also, share data in a format that can be pasted in an Excel workbook.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors