Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Weighted average from other table

Hello guys, I need your help on my task here...

 

I have two tables as shown below:

 

mantjah_3-1604852835987.png

 

I have 3 things to achieve:
1. Create columns like on a cell that I highlighted with a red-dotted box in Table 1. note: value on G column is acquired from table 2.

2. Create a measure like value on a cell with a blue-dotted box. The end goal is to create historical using line graph for that value by project.

3. Create a measure like value on a cell with a yellow-dotted box. The end goal is to create historical using line graph for that value by project.

 

the sample data: DataSample.xlsx - Google Drive 

 

Really appreciated for any helpful suggestions or step by step explanation. Thank you

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

Hi @Anonymous ,

 

We can create four measures to meet your requirement.

 

1. Create a relationship between sheet 1 and sheet 2.

 

wei1.jpg

 

2. We can create two measures to get the sheet 2 result.

 

Take up = DIVIDE(SUM('Sheet 2'[Sold]),SUM('Sheet 2'[Total Unit]))

 

Percentage Remaining Unit = 
DIVIDE(
    SUM('Sheet 2'[Remaining]),
    CALCULATE(SUM('Sheet 2'[Remaining]),ALLSELECTED('Sheet 2')))

 

wei2.jpg

 

3. Then we can create two measures to get the sheet 1 result.

 

Average Unit Price per Type = 
var _average = 
DIVIDE(
    CALCULATE(SUM('Sheet 1'[Price/Sqm]),FILTER(ALLSELECTED('Sheet 1'),'Sheet 1'[Unit Type]=MAX('Sheet 1'[Unit Type]))),
    CALCULATE(DISTINCTCOUNT('Sheet 1'[Floor Area]),FILTER(ALLSELECTED('Sheet 1'),'Sheet 1'[Unit Type]=MAX('Sheet 1'[Unit Type]))))
return
_average

 

Measure = SUMX('Sheet 2',[Average Unit Price per Type]*[Percentage Remaining Unit])

 

wei3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

2 REPLIES 2
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create four measures to meet your requirement.

 

1. Create a relationship between sheet 1 and sheet 2.

 

wei1.jpg

 

2. We can create two measures to get the sheet 2 result.

 

Take up = DIVIDE(SUM('Sheet 2'[Sold]),SUM('Sheet 2'[Total Unit]))

 

Percentage Remaining Unit = 
DIVIDE(
    SUM('Sheet 2'[Remaining]),
    CALCULATE(SUM('Sheet 2'[Remaining]),ALLSELECTED('Sheet 2')))

 

wei2.jpg

 

3. Then we can create two measures to get the sheet 1 result.

 

Average Unit Price per Type = 
var _average = 
DIVIDE(
    CALCULATE(SUM('Sheet 1'[Price/Sqm]),FILTER(ALLSELECTED('Sheet 1'),'Sheet 1'[Unit Type]=MAX('Sheet 1'[Unit Type]))),
    CALCULATE(DISTINCTCOUNT('Sheet 1'[Floor Area]),FILTER(ALLSELECTED('Sheet 1'),'Sheet 1'[Unit Type]=MAX('Sheet 1'[Unit Type]))))
return
_average

 

Measure = SUMX('Sheet 2',[Average Unit Price per Type]*[Percentage Remaining Unit])

 

wei3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

Anonymous
Not applicable

it is totally fine, i just give it a little adjustment and your solution is match with what i need.

thank you so much @v-zhenbw-msft 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.