cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

distribute quantities in several parts

I have this little problem and I don't know how to solve it
The problem in a summarized way and with little data is this: I have the data as in the first table I want to have a result as in the second table, my problem is that I do not know how to distribute with formulas the "06 Expenses" that has to be divided by the total of the m2 (240) and then multiply by the m2 corresponding to each house (70,80,90) I have tried in several ways, but I couldn't.
thank you very much for your support

DescriptionMatterm2Prototype 1
01 Foundation $ 300.0070house 1
02 Structure $ 250.0070house 1
03 Finishes $ 200.0070house 1
04 windows $ 150.0070house 1
05 doors $ 100.0070house 1
01 Foundation $ 301.0080house 2
02 Structure $ 251.0080house 2
03 Finishes $ 201.0080house 2
04 windows $ 151.0080house 2
05 doors $ 101.0080house 2
01 Foundation $ 302.0090house 3
02 Structure $ 252.0090house 3
03 Finishes $ 202.0090house 3
04 windows $ 152.0090house 3
05 doors $ 102.0090house 3
06 Expenses $ 1,000.00240all

Row labelshouse 1house 2house 3
01 Foundation $ 300.00 $ 301.00 $ 302.00
02 Structure $ 250.00 $ 251.00 $ 252.00
03 Finishes $ 200.00 $ 201.00 $ 202.00
04 windows $ 150.00 $ 151.00 $ 152.00
05 doors $ 100.00 $ 101.00 $ 102.00
06 Expenses $ 291.67 $ 333.33 $ 375.00
Total general $ 1,291.67 $ 1,338.33 $ 1,385.00

I thank you in advance!

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

Hi, @Syndicate_Admin |

Try to create a calculated table like this:

M_Table = 
var _m2_Pro=SUMMARIZE(FILTER(ALL('Table'),[Prototype 1]<>"all"),[m2],[Prototype 1])
var _Des_Mat=SUMMARIZE(FILTER(ALL('Table'),[Prototype 1]="all"),[Description])
var _t=CROSSJOIN(_m2_Pro,_Des_Mat)
var _add_Matter=
    SUMMARIZE(
        ADDCOLUMNS(_t,"Matter",CALCULATE(DIVIDE(MAX('Table'[Matter]),MAX('Table'[m2])),FILTER(ALL('Table'),'Table'[Description]=[Description]))*[m2]),[Description],[Matter],[m2],[Prototype 1])
return UNION(_add_Matter,'Table')

Then you can get the result with a matirx visual.
Result:

vangzhengmsft_0-1643262134403.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

2 REPLIES 2
v-angzheng-msft
Community Support
Community Support

Hi, @Syndicate_Admin |

Try to create a calculated table like this:

M_Table = 
var _m2_Pro=SUMMARIZE(FILTER(ALL('Table'),[Prototype 1]<>"all"),[m2],[Prototype 1])
var _Des_Mat=SUMMARIZE(FILTER(ALL('Table'),[Prototype 1]="all"),[Description])
var _t=CROSSJOIN(_m2_Pro,_Des_Mat)
var _add_Matter=
    SUMMARIZE(
        ADDCOLUMNS(_t,"Matter",CALCULATE(DIVIDE(MAX('Table'[Matter]),MAX('Table'[m2])),FILTER(ALL('Table'),'Table'[Description]=[Description]))*[m2]),[Description],[Matter],[m2],[Prototype 1])
return UNION(_add_Matter,'Table')

Then you can get the result with a matirx visual.
Result:

vangzhengmsft_0-1643262134403.png

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Syndicate_Admin , Try a new table like

 


var _1 = filter(distinct(selectcolumns(Table, "PR", Table[Prototype 1]) ),[PR]<> "all")
Var _2 = union(addcolumns(_1, "P1", _1[PR]) ,
addcolumns(_1, "P1", "all"))
var _3 = addcolumns( filter(generate(_2, Table), _2[PR] = [Prototype 1]), "New M2",if( [Prototype 1] = "all", [m2]/countrows(_1), [m2]))

 

Then you can use matrix viusal

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Dev Camp Session 22 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

Users online (953)