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
Anonymous
Not applicable

How To Display Percentage of Total

Hi,

 

How can I display the percentage of total next to the settlement? One column is text and the other column is GBP £.

 

PowerBi Query.PNG

Kind regards

 

Dom

1 ACCEPTED SOLUTION
MartynRamsden
Solution Sage
Solution Sage

Hi @Anonymous 

 

If Settlement is an explicit measure you can use a DAX expression like this:

% Settlement = 
VAR SettlementVal = [Settlement]
VAR AllSettlement =
CALCULATE (
    [Settlement],
    ALL ( Table1[Channel] )
)
VAR Result = DIVIDE ( SettlementVal, AllSettlement )
RETURN Result

 

If you've simply dropped the Settlement column from your data model and allowed Power BI to aggregate the result (i.e. an implicit measure), then simply add the column to the table again, right click it in the 'Values' field well and select Show value as>>Percent of grant total.

 

Capture.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

 

 

View solution in original post

3 REPLIES 3
MartynRamsden
Solution Sage
Solution Sage

Hi @Anonymous 

 

If Settlement is an explicit measure you can use a DAX expression like this:

% Settlement = 
VAR SettlementVal = [Settlement]
VAR AllSettlement =
CALCULATE (
    [Settlement],
    ALL ( Table1[Channel] )
)
VAR Result = DIVIDE ( SettlementVal, AllSettlement )
RETURN Result

 

If you've simply dropped the Settlement column from your data model and allowed Power BI to aggregate the result (i.e. an implicit measure), then simply add the column to the table again, right click it in the 'Values' field well and select Show value as>>Percent of grant total.

 

Capture.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best regards,

Martyn

 

If I answered your question, please help others by accepting it as a solution.

 

 

kentyler
Solution Sage
Solution Sage

Even though it looks like Power BI is adding up a column of numbers here, that is not what is really happening. Power BI calculates each cell individually, based on its filter context.

That means that to get the total amount you need to calculate the percent of total you will have to use a CALCULATE() statement and include the ALL() function. ALL removes the filters that the graphic is generating( to show one line at a time )and restores all the rows in your table so you can total them.

Percent of Total =

VAR Total Amount = CALCULATE(SUM(yourTable[Settlement]),ALL(yourTable))
VAR Current Amount = SELECTEDVALUE(YourTable[Settlement])

VAR PercentOfTotal = DIVIDE([Current Amount],[Total Amount])

RETURN PercentOftotal

I'm a personal Power Bi Trainer I learn something every time I answer a question

The Golden Rules for Power BI

  1. Use a Calendar table. A custom Date tables is preferable to using the automatic date/time handling capabilities of Power BI. https://www.youtube.com/watch?v=FxiAYGbCfAQ
  2. Build your data model as a Star Schema. Creating a star schema in Power BI is the best practice to improve performance and more importantly, to ensure accurate results! https://www.youtube.com/watch?v=1Kilya6aUQw
  3. Use a small set up sample data when developing. When building your measures and calculated columns always use a small amount of sample data so that it will be easier to confirm that you are getting the right numbers.
  4. Store all your intermediate calculations in VARs when you’re writing measures. You can return these intermediate VARs instead of your final result  to check on your steps along the way.



 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


amitchandak
Super User
Super User

Drag the same measure to values in the visual pane. Right click and check do you have the option "Show value AS". If yes click and choose % of Total

 

 

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.