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
WILLIH
Helper I
Helper I

DAX Percentage of filtered total

I'm new to Power BI and I'm looking to find the percentage on a stacked column chart or 100% chart after a filter selected. Example when no filters are selected the % amounts are shown as % of grand total which is correct but when a filter is selected I want the new % numbers to be shown as the filtered totals and not the grand totals.

 

In the table below the grand totoal percentages for the RED job are 21% for ACT, 14% for CNL and 21% for MOD. Which these percentage are from the grand total of 14 jobs.

If I only select the RED jobs then the percentages would change to 38% for ACT, 25% for CNL and 38% for MOD. All based off a grand total of 8 RED jobs.

How do I get my stacked column chart to show the change in percentage when a filter is selected and not the percentage base on the grand total?

 

Table1.PNG

Table2.PNG

 

1 ACCEPTED SOLUTION

Try below the DAX measure.

 

PercentageVal =
VAR total =
    CALCULATE ( COUNT ( Job_Status[Job] ), ALL ( Job_Status ) )
VAR countVal =
    CALCULATE ( COUNT ( Job_Status[Job] ) )
VAR result = countVal / total
RETURN
    result

 

Filter selectedFilter selected

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Filter not selectedFilter not selected

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Let me know your comments.

 

Regards,

Nandu Krishna


Regards,
Nandu Krishna

View solution in original post

3 REPLIES 3
nandukrishnavs
Super User
Super User

Can you provide the expected output in different scenarios? 


Regards,
Nandu Krishna

Try below the DAX measure.

 

PercentageVal =
VAR total =
    CALCULATE ( COUNT ( Job_Status[Job] ), ALL ( Job_Status ) )
VAR countVal =
    CALCULATE ( COUNT ( Job_Status[Job] ) )
VAR result = countVal / total
RETURN
    result

 

Filter selectedFilter selected

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Filter not selectedFilter not selected

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Let me know your comments.

 

Regards,

Nandu Krishna


Regards,
Nandu Krishna

Hi Nandu

This solution worked for me. The only thing I had to change was changing ALL to ALLSELECTED.

 

Thanks,

HW

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.

Top Solution Authors