DAX Formulas (wrong grand totals and missing values)

Paragin

New Member
Joined
Dec 3, 2018
Messages
1
Here is picture of needed data.
mv8qU1F.png

There is a piece of data (table 1). Primary data starts with March 2010 and I filtered it by Employee 1 and Employee 100.


As you can see Employee 1 was not at the Project in May and December, so in May Total Expenses change was -$700. One part of my task is to show how Total Expenses changes because of structural changes in a team. I created next formulas:

Current Salary:=SUM([Salary])

Salary in Previous Period:=CALCULATE([SalCur]; PREVIOUSMONTH('Calendar'[Date]))

Salary Change:=[SalCur]-[SalPrev]

And everything seems to work fine (table 2) (Grand totals are correct and values for periods when Employee leaves the project are shown) until this moment. Then I write formula, which shows only that values, where Employee comes in or leaves the project. Here it is:

Employee Turnover:=IF(OR([SalCur]-[SalPrev]=-[SalPrev]; [SalPrev]=0); [SalCur]-[SalPrev]; BLANK())

And here is the problem (table 3). If I filter the results by more than 1 employee, grand totals won't sum up correctly, but all values at their place and correclty calculated.

I read on the internet that there is fix for wrong grand totals and I used it.

FIX:=SUMX(VALUES(tbl_Utilization[Employee]); [EmployeeTurnover])

The result (table 4) is that grand totals are correct but values in periods where employee was not at the project are missed. How can I make PowerPivot 'see' negative values? As far as I understand the problem is that there is blank value for Employee 1 salary in May, but can I fix this? Maybe I am using wrong logic to calculate Total Expenses changes because of structural changes if that is the case I am looking forward to the suggestions.

P.S. I am new to Power Pivot

P.S.S I am not native English speaker, so excuse me for grammar mistakes

mv8qU1F
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,213,562
Messages
6,114,326
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top