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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.