Forum Discussion

pdemontigny's avatar
pdemontigny
Regular Visitor
9 years ago
Solved

Calculated Column: % of Total

I'm trying to recreate an Excel dashboard in Power BI. Part of what I need to do is create a table or matrix (not sure which is best) that shows premium by segment, which I've done. Now I want to create another column that calculates the % of total premium for each segment. The end result should look something like this.

 

SegmentInforce PremiumPremium Distribution
A$7,000,00054%
B$4,000,00031%
C$2,000,00015%
Total$13,000,000100%

 

In Excel, I can do this by referencing the cell with the premium for each segment and dividing by the total premium, like this:

 

ColumnBCD
RowSegmentInforce PremiumPremium Distribution
3A7000000=C3/$C$6
4B4000000=C4/$C$6
5C2000000=C5/$C$6
6Total=SUM(C3:C5)=C6/$C$6

 

My problem is I can't figure out how to reference the column total for premium. Does anyone know how I could do this % of total in Power BI?

  • parry2k's avatar
    parry2k
    9 years ago

    So you are saying that you don't want slicer to filter out the total data? In that case, you need to create calculated field.

     

    For that you need to create measure, let's say it is called Total Sales,

     

    Total Sales = CALCUALTE(SUM(Sales[Revenue]), ALL(Sales))

     

    % Revenue = SUM(Sales[Revenue])/[Total Sales]

    This is an idea, if you need further help, let me know.

4 Replies

  • Hi pdemontigny,

     

    You can achieve by creating a new calculated column with following formula,

     

    Premium Dist = DIVIDE(Question[Enforce Premium],SUM(Question[Enforce Premium])).

     

     Let me know, if you have any queries.

    • pdemontigny's avatar
      pdemontigny
      Regular Visitor

      Thanks for your help. This works, however, I want to add a slicer that allows the user to filter for a specific state - meaning the Inforce Premium volumes would change. Do you know how I could set up the formula so that Premium Dist shows the % of total premium for whatever subset of data the user has filtered for?

      • parry2k's avatar
        parry2k
        Super User

        So you are saying that you don't want slicer to filter out the total data? In that case, you need to create calculated field.

         

        For that you need to create measure, let's say it is called Total Sales,

         

        Total Sales = CALCUALTE(SUM(Sales[Revenue]), ALL(Sales))

         

        % Revenue = SUM(Sales[Revenue])/[Total Sales]

        This is an idea, if you need further help, let me know.