Forum Discussion

Elmoataz's avatar
Elmoataz
New Member
3 years ago
Solved

Percentage based on a group

Hello, I'm trying to create a column that shows the percentage based on the other columns. For example; in the picture below I got the percentage of each of the materials based on the Order number using the Amount column. So for the first Order Number (22), I got the percentage 50% for Boxes, 25% for Tables, and 25% for Chairs, so that's 100% total based on the Order Number column and then the other Order Number are the same. Thank you 

  • Hi,

    Please check the below picture and the attached pbix file.

     

     

     

     

     

    Percentage measure: =
    IF (
        HASONEVALUE ( 'Order Number'[Order number] ),
        DIVIDE (
            [Amount measure:],
            CALCULATE ( [Amount measure:], ALL ( Material[Materials] ) )
        )
    )
    

     

5 Replies

  • Jihwan_Kim Thank you so much. I have one more question. How can I get the average instead of the percentage? 

  • Hi,

    Please check the below picture and the attached pbix file.

     

     

     

     

     

    Percentage measure: =
    IF (
        HASONEVALUE ( 'Order Number'[Order number] ),
        DIVIDE (
            [Amount measure:],
            CALCULATE ( [Amount measure:], ALL ( Material[Materials] ) )
        )
    )
    

     

  • Jihwan_Kim , Him Kim, now I have an issue. When I filter out anything, the percentages stay the same. For example; for order number 45, when we filter out the Boxes, we will have 1000 Amount for the chairs and 1000 Amount for the tables, and the percentages should be 50% and 50%. But when I filter out the Boxes, the percentages stay the same as 25% and 25% as I didn't filter anything. Is there a way to fix this issue? Thank you so much for all your help.