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
Elmoataz
New Member

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 

Screenshot (402).png

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1668692847847.png

 

 

Jihwan_Kim_0-1668692826175.png

 

 

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

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

5 REPLIES 5
Elmoataz
New Member

@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.

Hi,

Thank you for your message.

Could you please change ALL to ALLSELECTED in the measure, and check whether it suits your requirement?

 

ALLSELECTED – DAX Guide

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Elmoataz
New Member

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

Hi,

Thank you for your message.

Please check the attached file.

Thanks.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1668692847847.png

 

 

Jihwan_Kim_0-1668692826175.png

 

 

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

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.