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