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
rfernandes
Helper I
Helper I

Distribute values by column data

Hello everyone,

I have a database that when aggregated looks like this:

 

ProductColorSales%
CarBlack2035.7%
Bike 610.7%
BikeBlack2035.7%
BikeWhite1017.9%

 

In the bike product, i have a few bike units without color.  And i need to vizualize it without the black cell, but in a way that i don´t lose total sales. Is it possible to distribute the data proportionally inside the same product category?

The output should look like this:

 

ProductColorSales%
CarBlack2035.7%
BikeBlack2442.9%
BikeWhite1221.4%

 

Thank you,

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @rfernandes 

Assume 6 is assigned

2/3 to product bike and color blank,   ->20/(20+10)

1/3 to product bike and color white,   ->10/(20+10)

 

Then i create measures

v/c/pr = CALCULATE(SUM(Table1[Sales]),FILTER(ALLEXCEPT(Table1,Table1[Product]),Table1[Color]=MAX(Table1[Color])))

sum/c/pr = CALCULATE(SUM(Table1[Sales]),FILTER(ALLEXCEPT(Table1,Table1[Product]),Table1[Color]<>BLANK()))

per/col/pro = [v/c/pr]/[sum/c/pr]

sum/blank/product = CALCULATE(SUM(Table1[Sales]),FILTER(ALLEXCEPT(Table1,Table1[Product]),Table1[Color]=BLANK()))

result_sale = IF(MAX(Table1[Color])<>BLANK(),MAX(Table1[Sales])+[sum/blank/product]*[per/col/pro])

result_per = [result_sale]/CALCULATE(SUM(Table1[Sales]),ALL(Table1))

12.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @rfernandes 

Is this problem sloved? 

If it is sloved, could you kindly accept it as a solution to close this case?

If not, please let me know.

 

Best Regards

Maggie

Yes, thank you!

 

Sry for late reply, i was on vacation. 

v-juanli-msft
Community Support
Community Support

Hi @rfernandes 

Assume 6 is assigned

2/3 to product bike and color blank,   ->20/(20+10)

1/3 to product bike and color white,   ->10/(20+10)

 

Then i create measures

v/c/pr = CALCULATE(SUM(Table1[Sales]),FILTER(ALLEXCEPT(Table1,Table1[Product]),Table1[Color]=MAX(Table1[Color])))

sum/c/pr = CALCULATE(SUM(Table1[Sales]),FILTER(ALLEXCEPT(Table1,Table1[Product]),Table1[Color]<>BLANK()))

per/col/pro = [v/c/pr]/[sum/c/pr]

sum/blank/product = CALCULATE(SUM(Table1[Sales]),FILTER(ALLEXCEPT(Table1,Table1[Product]),Table1[Color]=BLANK()))

result_sale = IF(MAX(Table1[Color])<>BLANK(),MAX(Table1[Sales])+[sum/blank/product]*[per/col/pro])

result_per = [result_sale]/CALCULATE(SUM(Table1[Sales]),ALL(Table1))

12.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.