Search code examples
powerbipowerbi-desktoppowerbi-datasource

Power BI calculate percentage (divide) using Filter


I need to show percentage in gauge chart something like this

enter image description here

I am able to bring 3000 and 37% is the something that needs to be calculated. This guage charts need to show that the data you are looking for/filtering holds 37% of 3000 (i.e. 1110)

Now I need to bring this 37% in gauges chart "Target value" property. I need to write a measure that will divide the filter value of 1110 by 3000 that will bring the value as 37% in a measure. Then I can drag the measure under Target value property.

I have written one measure that essentially does something like this:

enter image description here

This measure is resulting in value of 1 which is not right.

For example: I have 3 products - A, B & C and I want to find how much Percentage Product A accounts of total of Products A+B+C. In previous example say product A accounts for 1110, product B for 1500 and C for 390

How do I modify my measure so that it gives me the result only for Product A? I know filter function is helpful - not sure how. any new answers are also appreciated

Thanks


Solution

  • Gauge do not support this directly as per my knowledge. But there is work around as given below-

    Step 1: Create a measure with value 0 to set as Gauge Minimum value and set the type of this measure as Percentage "%".

    m_min_value = 0
    

    Step 2: Create a measure with value 1 to set as Gauge Maximum value and set the type of this measure as Percentage "%".

    m_max_value = 1
    

    Step 3: Here, I guess you have your measure ready which is showing 37% in your case. If this is the case, just configure your gauge as below-

    enter image description here

    Step 4: Of "Data Lebels" from the Gauge settings. Take a "CARD" visual with Maximum value which is showing 3000 in your case. Now place the CARD as shown in the below image with disabling CARD background from the settings.

    enter image description here