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
micalarsen
New Member

Calculate measure "Percent of Total" based on Dynamic Filters

Hi,

 

Is anyone able to help me out with a simple calculation for a percentage out of total given selected filters.

 

How do you make your own measure calculation in a formula that provide the same result based on the multiple filters selection?

 

I don’t think the formula I have tried to make is useful at all. I have tried a formula like this (it does not work at all☹).

 

Quantity % = 
DIVIDE (
    CALCULATE (
        SUM ( Transactions[quantity] );
        FILTER ( ALLSELECTED ( region_lookup[Sales_region]);
    CALCULATE ( SUM ( Transactions[quantity] )))))

 

I get the following error message: Too few arguments were passed to the Divide function. The minimum argument count for the function is 2 (see screen dump below)

 

formula errorformula error

I know there is the an easy "Quick Measure" in e.g. the Metrix visual, which can to show the percentage of column total (see the  screen dump of the report below). Is it possible to change the predefined column header name “%CT” made by the quick measure function?

Quick Measure - percentage of column.png

 

 

In addition to this matter, does anyone know how to get the percentage shown on a pie chart as labels either within the color area or on the side. The tooltip is able to show both the total numeric value and percentage (see the example below).

 

Tooltip containing automatic percentage calculation.png

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @micalarsen,

 

Please modify the formula as below:

Quantity % =
DIVIDE (
    CALCULATE (
        SUM ( Transactions[quantity] );
        ALLSELECTED ( region_lookup[Sales_region] )
    );
    CALCULATE ( SUM ( Transactions[quantity] ) )
)

To get the percentage shown on a pie chart as labels, you can choose an item from the "Label Style" list.

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

4 REPLIES 4
v-yulgu-msft
Employee
Employee

Hi @micalarsen,

 

Please modify the formula as below:

Quantity % =
DIVIDE (
    CALCULATE (
        SUM ( Transactions[quantity] );
        ALLSELECTED ( region_lookup[Sales_region] )
    );
    CALCULATE ( SUM ( Transactions[quantity] ) )
)

To get the percentage shown on a pie chart as labels, you can choose an item from the "Label Style" list.

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

I usually do this:

 

image.png


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg

 

Thanks for your answer. I know that quick measure function. Do you know how to change the name of the new automated generated measure value?

 

Further on I am trying to make a measure formula that is able to do the same. Meaning that the measure will be calculating a percentage of the selected filter values.

You just double-click it and rename it.

 

For your own measure, try this: https://community.powerbi.com/t5/Quick-Measures-Gallery/Percent-of-Total/m-p/163661

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.