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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
maxabele
Frequent Visitor

Average Cost per ID and Month

Hi all,

 

I tried searching in the community but nothing has either helped or was specific to my problem. 

 

I have data in the following format and I need to calculate the adjusted average salary per month. (adjusting for % working time, i.e. salary * % working time).

 

Person IDSalary% Working Time Effective DateMonthAdj. Salary
12310001001.4.20204?
12310009015.4.20204?
1231000801.5.20205?
1231000701.6.20206?
9992000501.4.20204?
9992000401.5.20205?
9992000301.6.20206?

 

The adj. salary should be aggregrated by person and month.

Any help is greatly appreciated!

 

Thanks in advance and best,

Max 

1 ACCEPTED SOLUTION

Hi @maxabele ,

 

Create 2 calculated Columns

 

 

Adjusted Salary = 'Table'[Salary] * DIVIDE('Table'[% Working Time ],100)
 
 
AverageC =
CALCULATE(AVERAGE('Table'[Adjusted Salary]),ALLEXCEPT('Table','Table'[Person ID],'Table'[Month]))
 
 
Create 2 Measure
 
Maxxx = CALCULATE(MAX('Table'[AverageC]),ALLEXCEPT('Table','Table'[Month],'Table'[Person ID]))
 
Measure = CALCULATE(SUMX(DISTINCT('Table'[Person ID]),[Maxxx]))
 
 
1.jpg2.JPG
 
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@maxabele , Try like

New column =table[Salary]*table[% Working Time]/100.0

 

New Measure =sumx(Table, table[Salary]*table[% Working Time]/100.0)

Thank you! With your formula, it's adding the rows for the same person and month up. For instance, in this example for employee 123 the result for month 4 is: 1900 instead of 950. 

Hi @maxabele ,

 

Create 2 calculated Columns

 

 

Adjusted Salary = 'Table'[Salary] * DIVIDE('Table'[% Working Time ],100)
 
 
AverageC =
CALCULATE(AVERAGE('Table'[Adjusted Salary]),ALLEXCEPT('Table','Table'[Person ID],'Table'[Month]))
 
 
Create 2 Measure
 
Maxxx = CALCULATE(MAX('Table'[AverageC]),ALLEXCEPT('Table','Table'[Month],'Table'[Person ID]))
 
Measure = CALCULATE(SUMX(DISTINCT('Table'[Person ID]),[Maxxx]))
 
 
1.jpg2.JPG
 
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Works fantastic, thank you so much!!

harshnathani
Community Champion
Community Champion

Hi @maxabele ,,

 

Are you looking for something like this?

 

1.jpg

 

Can you share the expected output.

 

Regards,

Harsh Nathani

 

 

Hi Harsh, thank you for your response. 

 

The expected output is:

Salary Cost = 1000* 95% (Average 100 & 90) + 2000*50% = 1950

 

MonthSalary Cost
41950
51600
61300

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.