Forum Discussion

M_SBS_6's avatar
M_SBS_6
Helper V
2 years ago
Solved

Percentage by groups

Hi, 

If I have the following table

 

Hi, 

I have the following table and what I want to do is group up the row percentage based on the total value per ID. 

 

Example: The total value for ID 1 = 1000 so the 4 rows of values, I need to see the percentage of ID 1 total. 100/1000 = 10% etc. I have added in ID 2 as that follows the same pattern. At the moment, my % column is a percentage of the grand total which isn't what I want. Is there anyway to add a group by into the calculations please? 

 

ID. Value. %

1 100. 10%

1. 100. 10%

1. 300. 30%

1. 500. 50%

Total 1000. 100%

2. 200. 40%

2. 100. 20%

2. 200. 40%

Total. 500. 100%

  • You can create a calculated column (not a measure) to get your desired results.

     

    DIVIDE(
        [Value],
        CALCULATE(
            SUM(Table1[Value]),
            ALLEXCEPT(Table1, Table1[ID])
        )
    )
     

     

    If I answered your question, please mark this thread as accepted and Thums Up!
    Follow me on LinkedIn:
    https://www.linkedin.com/in/mustafa-ali-70133451/

1 Reply

  • amustafa's avatar
    amustafa
    Solution Sage

    You can create a calculated column (not a measure) to get your desired results.

     

    DIVIDE(
        [Value],
        CALCULATE(
            SUM(Table1[Value]),
            ALLEXCEPT(Table1, Table1[ID])
        )
    )
     

     

    If I answered your question, please mark this thread as accepted and Thums Up!
    Follow me on LinkedIn:
    https://www.linkedin.com/in/mustafa-ali-70133451/