Forum Discussion

TamlerlovesKant's avatar
TamlerlovesKant
Frequent Visitor
4 years ago
Solved

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 
 

 

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

 

 

kind regards,

James

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    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])

     

     

     

    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.

     

     

4 Replies

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

    • TamlerlovesKant's avatar
      TamlerlovesKant
      Frequent Visitor

      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?

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        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])

         

         

         

        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.