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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
TamlerlovesKant
Frequent Visitor

Filtering SUM Value Based on Another Measure

Hi All!

 

i am trying to multiply the amount of days a piece of equipment was on a project by the AVG. cost of that equipment to achieve a total cost of plant on project. 

 

the current formula to calculate Total project cost of plant is:

Total Project cost for Plant = DayDiaryPlantList_Sharepoint[Day Diary Plant Days] * SUM(Plant[AVG. Plant & Vehicle Cost Per day]) but that appears to be summing all AVG Values; it then applies those values to the project 
 

Screenshot 2021-11-05 142315.jpg

 

the problem i am experiencing is that Total Project Cost for Plant is Multiplying the Total sum of "Day Diary Plant Days" by the Total Sum of "AVG. Plant & Vehicle cost per day" so the total being applied is $1921.39 instead of the desired $65.87.

 

my data structure is below; with cost values being from the APPosted Invoices Query; and day docket master and plant list being the fact tables for project and plant;

total plant days is calculated by:
Day Diary Plant Days = CountRows(Filter(DayDiaryPlantList_Sharepoint,CONTAINS(DayDiaryMaster_Sharepoint,DayDiaryMaster_Sharepoint[Id],DayDiaryPlantList_Sharepoint[MasterID])))

 

Master list of Projects is in the Project Query, and master list of Equipment is in "Plant" Query

 

TamlerlovesKant_1-1636083374529.png

 

kind regards,

James

 

1 ACCEPTED SOLUTION

Hi @TamlerlovesKant ,

 

12605 is 2521*5, that is, the total of AVG Plant Cost per Day is multiplied by the total of Assigned Equipment Days.

You can create a new measure to get the results you want.

Measure = SUMX('Equipment List',[Plant Assigned Cost])

1.png2.png

 

 

 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. Please show the expected outcome.

Hi @lbendlin,

 

Thanks for getting in touch on this one; i have created a simplified and Sanitised Data model which can be viewed below:

https://1drv.ms/u/s!Aqcds9Zosni5iG0KXKTyExJSeeaD?e=mds6P7 

 

The outcome i would like to achieve is

AVG plant cost per day * Assigned equipment days;

 

wherein apply the average daily cost of a piece of equipment (which is referencing the Invoices Column) and apply that value average value to a project whenever the piece of equipment is assigned to the project (using the day diary)

 

as you can see in the image below, it appears to be filtering and applying the values correct, but the total value for "Plant assigned cost" doesnt seem to add up properly;

 

the cost that i want applied to the project is 1502.67+641.33+1449.00 = $3593.00 but instead the total is $12605.00 and i cant figure out why?

 

TamlerlovesKant_0-1636413049367.png

 

Hi @TamlerlovesKant ,

 

12605 is 2521*5, that is, the total of AVG Plant Cost per Day is multiplied by the total of Assigned Equipment Days.

You can create a new measure to get the results you want.

Measure = SUMX('Equipment List',[Plant Assigned Cost])

1.png2.png

 

 

 

Best Regards,

Stephen Tao

 

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

 

 

Thankyou so much Stephen!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.