+ Reply to Thread
Results 1 to 4 of 4

DAX Formulas (worng grand totals and missing values)

  1. #1
    Registered User
    Join Date
    12-03-2018
    Location
    Belarus
    MS-Off Ver
    2019
    Posts
    2

    DAX Formulas (worng grand totals and missing values)

    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
    Attached Images Attached Images

  2. #2
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: DAX Formulas (worng grand totals and missing values)

    Hi,
    Could you please provide an example file rather than a screen shot? I can not experiment with an image

    Regards Kurt

  3. #3
    Registered User
    Join Date
    12-03-2018
    Location
    Belarus
    MS-Off Ver
    2019
    Posts
    2

    Re: DAX Formulas (worng grand totals and missing values)

    Hi, Kurt!

    Here is example file.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: DAX Formulas (worng grand totals and missing values)

    That file is merely data with no formulas.

    I can't check your logic unless you provide the actually formulas you are using.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Grand totals for sub-columns
    By CathrineB in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-17-2017, 06:05 PM
  2. Pivot Table Percentage of grand totals listed under the grant totals
    By Biker102 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-31-2017, 01:31 PM
  3. More Detailed Grand Totals
    By ehassell01 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-10-2015, 10:45 PM
  4. Adding up values and grand totals through vba
    By grkchakri in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2014, 01:08 PM
  5. Method for calculating Invoice Totals and Grand totals
    By sahran4441 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-06-2010, 10:24 PM
  6. Replies: 4
    Last Post: 01-10-2008, 12:31 PM
  7. [SOLVED] Can't get Grand Totals (rows) to appear
    By TonyG in forum Excel General
    Replies: 1
    Last Post: 05-23-2006, 10:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1