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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Rob_Morris
Helper I
Helper I

Showing the percentage for row measure for multiple variables in a matrix

I have a matrix to show KPI performance with multiple KPI's (field name = job_kpi) and also whether they have passed or failed each month (this is field name = kpi_check).

 

powerbi kpitable.jpg

 

What I am trying to do is to get the percentage values to display the correct values each month for the pass and fail fields.

So for KPI 1 for April 2021 it would do a calculation for fail of (100/103)*3    but for pass it would do (100/103)*100.

I'm new to power bi / dax so not sure if this is possible - and if so how would I code it so that the figure only looks at the KPI in question, and then does the calculation based on that month only?

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Rob_Morris ,

According to your description, I create a sample.

vkalyjmsft_0-1648523680700.png

Here's my solution.

Create a measure.

% =
VAR _Parent =
    IF (
        ISFILTERED ( 'Table'[KPI Status] ),
        CALCULATE ( COUNT ( 'Table'[KPI Status] ), ALL ( 'Table'[KPI Status] ) ),
        CALCULATE ( COUNT ( 'Table'[KPI Status] ), ALL ( 'Table'[Job_kpi] ) )
    )
RETURN
    DIVIDE ( COUNT ( 'Table'[KPI Status] ), _Parent )

Get the correct result.

vkalyjmsft_1-1648523788600.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

View solution in original post

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @Rob_Morris ,

According to your description, I create a sample.

vkalyjmsft_0-1648523680700.png

Here's my solution.

Create a measure.

% =
VAR _Parent =
    IF (
        ISFILTERED ( 'Table'[KPI Status] ),
        CALCULATE ( COUNT ( 'Table'[KPI Status] ), ALL ( 'Table'[KPI Status] ) ),
        CALCULATE ( COUNT ( 'Table'[KPI Status] ), ALL ( 'Table'[Job_kpi] ) )
    )
RETURN
    DIVIDE ( COUNT ( 'Table'[KPI Status] ), _Parent )

Get the correct result.

vkalyjmsft_1-1648523788600.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

Brilliant! Thanks for this it's sorted the issue perfectly.

lbendlin
Super User
Super User

Instead of showing as percentage of column total, show as percentage of parent total.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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