cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mglatos
New Member

% of specific status measure

Hi All,

 

Hope someone can help me with that. I'm trying to create measure which calculate % of total amount of ID's based on status (outstanding or completed). Unfortunately the way my data source is created I cannot figure out a way to do that. 

Base on below data how to create % of Outstanding  to show as 75% ?

 

ID   Status

2     Outstanding

3     Close

4     Outstanding

6     Outstanding

 

I hope it make sense?

 

Thanks a lot!

5 REPLIES 5
Phil_Seamark
Microsoft
Microsoft

This should work as a measure

 

Measure = DIVIDE(
				 CALCULATE(COUNTROWS('Table1')) , 
				 CALCULATE(COUNTROWS(all(Table1)) 
					 )

Can probably do it as a calculated column if need too..


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Thank you so much for replying! I've just tried that and unfortunately it's doesn't work for me.

In the 'table1' you selecting whole table, correct?

Mine Measure looks like that - but I've might have made a mistake. Would you mind have a look?

 

Measure = DIVIDE(
                 CALCULATE(COUNTROWS('ALL_DATA_x')) ,
                 CALCULATE(COUNTROWS(all(ALL_DATA_x[Status] ))
                     ))

Does this looks correct?

 

Thanks a lot

Sean
Community Champion
Community Champion

Try these instead

Measure 1 =
DIVIDE (
    COUNTROWS ( 'ALL_DATA_x' ),
    CALCULATE ( COUNTROWS ( 'ALL_DATA_x' ), ALL ( 'ALL_DATA_x' ) ),
    0
)

Measure 2 =
DIVIDE (
    COUNTA ( 'ALL_DATA_x'[Status] ),
    CALCULATE ( COUNTA ( 'ALL_DATA_x'[Status] ), ALL ( 'ALL_DATA_x' ) ),
    0
)

 

 EDIT: You may change ALL to ALLSELECTED if necessary Smiley Happy

Thank you so much for replying! I've just tried that and unfortunately it's doesn't work for me.

In the 'table1' you selecting whole table, correct?

Mine Measure looks like that - but I've might have made a mistake. Would you mind have a look?

 

Measure = DIVIDE(
                 CALCULATE(COUNTROWS('ALL_DATA_x')) ,
                 CALCULATE(COUNTROWS(all(ALL_DATA_x[Status] ))
                     ))

Does this looks correct?

 

Thanks a lot

Hi @mglatos,

You should add a filter in your measure. I try to reproduce using your given sample data.

1.PNG

 If you want to calculate  % of Outstanding, please add ALL_DATA_x[Status]="Outstanding" filter, please review the following formula.

Measure = DIVIDE(CALCULATE(COUNTROWS(Table5),FILTER(Table5,Table5[Status]="Outstanding")),CALCULATE(COUNTROWS(Table5),ALL(Table5)))



Format the measure as %(highlighted in red line), and create a Card visual to dislay the result.

1.PNG

If you have other issues, please let me know.

Best Regards,
Angelia

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Top Solution Authors