Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Calculate OCPH per account category

Hi,

 

Im trying to calculate OCPH (overhead cost per hour) per account category:

 

My data is structured in the following way:

Cost objectAccountAmountQty
A50002004
A55002000
B50005005
B55003000
C5000500
C55003000
C50002000
A9000-500-5
B9000-350-4
C9000-400-4

 

Account mapping table

AccountAccount category
5000Expense 1
5500Expense 2
9000Hours

 

My goal is to visualize my data in actual OCPH per account category (expense 1, 2, .....) per cost object

Cost object50005500Total costHoursOCPH totalOCPH Expense 1OCPH Expense 2System OCPH
A2002004005804040100
B50030080042001257587,5
C2503005504137,562,575100

 

 

I have a measure for Total cost

Total cost = CALCULATE ( reporting value* ; 'account mapping' [account category] <> "Hours" )

And a measure for the Hours

Hours = CALCULATE (  quantity** ; 'account mapping' [account category] = "Hours" ) *-1

 

 

I have tried to use a simple DIVIDE formula,

 

OCPH per account category = DIVIDE ( Total cost ; Hours ; 0 )

 but that wont give me any data per cateogory because there is no DENOMINATOR per expense Account category, only in the "Hours" account category.

 

My report is ending up like this:

No filter on Cost object   
Account categoryTotal costTotal hoursOcPH
Expense 1950  
Expense 2800  
Hours 13 
Total175013134,62

 

 

 

But my goal is to visualize the data like this:

No filter on Cost object   
Account categoryTotal costTotal hoursOcPH
Expense 1950 73,08
Expense 2800 61,54
Hours 13 
Total175013134,62


Any hints on what I need to do to make this work? All help is highly appreciated.

 

 

* This is a measure summarizing amounts on all accounts

** This is a measure summarizing Qty on all accounts

  • Hi@ wes15

    After my research , you can use these three measure like below:

    Hours = CALCULATE (  SUM(Table2[Qty]) , FILTER(Table3,Table3[Account category] = "Hours" ) )*-1
    Total cost = CALCULATE ( SUM(Table2[Amount]),  FILTER(Table3,Table3[Account category] <> "Hours" ))
    OCPH per account category = VAR F=CALCULATE (  SUM(Table2[Qty]) , FILTER(ALL(Table3),Table3[Account category] = "Hours" ) )*-1 RETURN 
    CALCULATE(DIVIDE([Total cost],F))

     

    Result:

    Here is Demo , please try it

     

    https://www.dropbox.com/s/wihqdyqmf97431q/Calculate%20OCPH%20per%20account%20category.pbix?dl=0

     

     

     

     

    Best Regards,

    Lin

     

2 Replies

  • v-lili6-msft's avatar
    v-lili6-msft
    Icon for Community Support rankCommunity Support

    Hi@ wes15

    After my research , you can use these three measure like below:

    Hours = CALCULATE (  SUM(Table2[Qty]) , FILTER(Table3,Table3[Account category] = "Hours" ) )*-1
    Total cost = CALCULATE ( SUM(Table2[Amount]),  FILTER(Table3,Table3[Account category] <> "Hours" ))
    OCPH per account category = VAR F=CALCULATE (  SUM(Table2[Qty]) , FILTER(ALL(Table3),Table3[Account category] = "Hours" ) )*-1 RETURN 
    CALCULATE(DIVIDE([Total cost],F))

     

    Result:

    Here is Demo , please try it

     

    https://www.dropbox.com/s/wihqdyqmf97431q/Calculate%20OCPH%20per%20account%20category.pbix?dl=0

     

     

     

     

    Best Regards,

    Lin

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Cheers v-lili6-msft, works like a charm. Much appreciated!