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
SophRow
Resolver II
Resolver II

% of grand total by field parameter

Hi Experts,

 

Can you help me with a measure so I can show the percentage by Service on the following bar chart:

 

SophRow_0-1685940265818.png

 

So for Total Services, the % would be (by Illness Burden Category per example above):

 

  • 1-5: 3.8%
  • 6-10: 8.7%
  • 11-15: 19.7%
  • 16-20: 67.8%

The data looks like this:

 

SophRow_1-1685940422146.png

 

And the Illness burden category is a field parameter:

 

SophRow_2-1685940464947.png

 

When I switch to Age range and Gender, I also want the chart to show % of total by Service. 

 

Thanks in advance 🙂

Soph

 

3 REPLIES 3
data_freak
Regular Visitor

Hey @SophRow 

Apologies for the confusion. The use of SUM('Table'[Count]) and [Total Count] in my previous response was incorrect. There is no difference between them, and it was an oversight on my part.

To clarify, you only need to create the "Total Count" measure using the formula. Hope this helps!

data_freak
Regular Visitor

Hi @SophRow 

 

I think the following steps should help in solving this problem:

 

  • Start by creating a bar chart with the Service as the axis and the count of records as the value.
  • Create a new measure to calculate the total count of records. You can use the following DAX formula:

Total Count = SUM('YourTable'[YourCount field])

 

  • Create another measure to calculate the percentage by service. You can use the following DAX formula:

Percentage by Service = DIVIDE(SUM('Table'[Count]), [Total Count])

 

  • Add the newly created "Percentage by Service" measure to the Values section of the visual. Make sure it is set to display as a percentage. Next, to switch to Age range and Gender, create a slicer or dropdown list for the Illness burden category field.
  • Add the Illness burden category field to the visual as a legend or axis, depending on your desired visual representation.
  • Now, when you select different values in the Illness burden category slicer or dropdown list, the bar chart will automatically update to show the percentage of the total by service based on the selected category.

 

Please cross check that you have the appropriate relationships established between the tables in your data model to ensure accurate calculations.

 

If this has solved your problem, please mark my post as solution.

Cheers

Thanks @data_freak - just a quick Q - for the % by service measure, what's the difference between SUM('Table'[Count]) and Total Count?

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.