cancel
Showing results for
Did you mean:
Highlighted
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 ID Salary % Working Time Effective Date Month Adj. Salary 123 1000 100 1.4.2020 4 ? 123 1000 90 15.4.2020 4 ? 123 1000 80 1.5.2020 5 ? 123 1000 70 1.6.2020 6 ? 999 2000 50 1.4.2020 4 ? 999 2000 40 1.5.2020 5 ? 999 2000 30 1.6.2020 6 ?

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

Any help is greatly appreciated!

Max

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion

## Re: Average Cost per ID and Month

Hi @maxabele ,

Create 2 calculated Columns

Adjusted Salary = 'Table'[Salary] * DIVIDE('Table'[% Working Time ],100)

AverageC =

Create 2 Measure

Maxxx = CALCULATE(MAX('Table'[AverageC]),ALLEXCEPT('Table','Table'[Month],'Table'[Person ID]))

Measure = CALCULATE(SUMX(DISTINCT('Table'[Person ID]),[Maxxx]))

Regards,
Harsh Nathani

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

6 REPLIES 6
Highlighted
Community Champion

## Re: Average Cost per ID and Month

Hi @maxabele ,,

Are you looking for something like this?

Can you share the expected output.

Regards,

Harsh Nathani

Highlighted
Frequent Visitor

## Re: Average Cost per ID and Month

Hi Harsh, thank you for your response.

The expected output is:

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

 Month Salary Cost 4 1950 5 1600 6 1300
Highlighted
Super User IV

## Re: Average Cost per ID and Month

@maxabele , Try like

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

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

My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Frequent Visitor

## Re: Average Cost per ID and Month

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.

Highlighted
Community Champion

## Re: Average Cost per ID and Month

Hi @maxabele ,

Create 2 calculated Columns

Adjusted Salary = 'Table'[Salary] * DIVIDE('Table'[% Working Time ],100)

AverageC =

Create 2 Measure

Maxxx = CALCULATE(MAX('Table'[AverageC]),ALLEXCEPT('Table','Table'[Month],'Table'[Person ID]))

Measure = CALCULATE(SUMX(DISTINCT('Table'[Person ID]),[Maxxx]))

Regards,
Harsh Nathani

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

Highlighted
Frequent Visitor

## Re: Average Cost per ID and Month

Works fantastic, thank you so much!!

Announcements

#### August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

#### Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

#### Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

#### Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors