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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

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

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community 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:

7.png

Here is Demo , please try it

 

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

 

 

 

 

Best Regards,

Lin

 

Community Support Team _ Lin
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

2 REPLIES 2
v-lili6-msft
Community Support
Community 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:

7.png

Here is Demo , please try it

 

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

 

 

 

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.