+ Reply to Thread
Results 1 to 12 of 12

DAX - SUMPRODUCT Help

  1. #1
    Registered User
    Join Date
    12-28-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    7

    DAX - SUMPRODUCT Help

    Hi all,

    I have two columns on my Data Model ,one that checks if it's a working date and another with the employees of each given date.
    I tried to create a measure to calculate how many hours these employees will produce(8 Hrs work) which works fine on the pivot table for each date but the total is not showing the correct number(due to the fact that the employees number is not the same every day).

    I'm guessing that my Dax is missing a filter or something since i multiply column row by column row..

    Example below instead of getting 1120 which is the real sum i get another number)



    Date Leaves Employees WorkDay Hours

    01/10/2021 7 1 56
    02/10/2021 7 0 0
    03/10/2021 7 0 0
    04/10/2021 7 1 56
    05/10/2021 7 1 56
    06/10/2021 7 1 56
    07/10/2021 7 1 56
    08/10/2021 7 1 56
    09/10/2021 7 0 0
    10/10/2021 7 0 0
    11/10/2021 7 1 56
    12/10/2021 7 1 56
    13/10/2021 7 1 56
    14/10/2021 7 1 56
    15/10/2021 7 1 56
    16/10/2021 7 0 0
    17/10/2021 7 0 0
    18/10/2021 7 1 56
    19/10/2021 7 1 56
    20/10/2021 7 1 56
    21/10/2021 7 1 56
    22/10/2021 7 1 56
    23/10/2021 1 7 0 0
    24/10/2021 6 0 0
    25/10/2021 6 1 48
    26/10/2021 6 1 48
    27/10/2021 6 1 48
    28/10/2021 2 6 1 48
    29/10/2021 4 1 32
    30/10/2021 4 0 0
    31/10/2021 4 0 0
    TOTAL 3 7 21 1176




    Any suggestion would be more than welcome!

    Cheers,
    Kyr Manolis

  2. #2
    Registered User
    Join Date
    11-02-2020
    Location
    Paris, France
    MS-Off Ver
    Professional Plus 2013
    Posts
    41

    Re: DAX - SUMPRODUCT Help

    I'm not sure the example file is correct if I parse the info you've provided.
    Could you confirm/correct it ?
    Attached Files Attached Files
    ⭹ If this helped you, please add reputation

  3. #3
    Registered User
    Join Date
    12-28-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    7

    Re: DAX - SUMPRODUCT Help

    Quote Originally Posted by Exl-Noob View Post
    I'm not sure the example file is correct if I parse the info you've provided.
    Could you confirm/correct it ?
    Hey Exl-Noob,

    I re-attached the correct data format.

    Cheers
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: DAX - SUMPRODUCT Help

    That doesn't help much as we can't see what formulae you're usng. What is the significance of the 7 in C34 and the 21 in D34?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,000

    Re: DAX - SUMPRODUCT Help

    In fact, would YOU attach YOUR sheet, so we can see wht YOU are doing.... See the yellow banner (top of page) for instructions on how to post a sample.

  6. #6
    Registered User
    Join Date
    11-02-2020
    Location
    Paris, France
    MS-Off Ver
    Professional Plus 2013
    Posts
    41

    Re: DAX - SUMPRODUCT Help

    Oh I see. You modified some data in the latest upload.

    Seems that the column names got me confused. "Employees" stands for "Nb of employees". I thought it was a number that defined a specific employee.
    And it seems you are willing to calculate the total amount of hours of work your employees could produce, based on they presence after you have accepted their vacations (thus the number in columns C that varies if they intend to be present or not).

    Also, you are apparently willing that we work from the pivot table, and not from the raw data set?
    That might be difficult.
    What would help would be to provide an anonymous sample of your raw data and we could show you how we could do it.
    Like Glenn I'm puzzled by the 7 on C34. It makes no sense, unless you wanted the max() value there

  7. #7
    Registered User
    Join Date
    12-28-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    7

    Re: DAX - SUMPRODUCT Help

    Much easier with the file x)

    7 in C34 is(theoretically) the sum of active employees and the 21 in D34 is related with working days per month).

    Cheers,
    Kyr Manos
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-02-2020
    Location
    Paris, France
    MS-Off Ver
    Professional Plus 2013
    Posts
    41

    Re: DAX - SUMPRODUCT Help

    Well I can't help.
    With my french localized version of excel, the calculated field in the pivot table can't be modified since it detects an error (formula isn't translated). And on top of that Excel won't let me access to the list of calculated formulas to change it.
    So I'll leave it to others

    But why did you use a segment and not a chronology to filter the pivot table?

  9. #9
    Registered User
    Join Date
    12-28-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    7

    Re: DAX - SUMPRODUCT Help

    The only calculated formula is on my calendar table (to check if it's a working date or not using a SWITCH function) and then i'm trying to multiply these working days with the employees active for each period(and the hours produced for each day)

    Measure :
    Calculate( COUNTROWS(Table1), Filter (ALLEXCEPT(Table1,Table1[Employee]),Table1[Hire Date] < MAX(Calendar[Date]) && Table1[ExpectedContractEndDate]>=MIN(Calendar[Date])))

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: DAX - SUMPRODUCT Help

    Maybe try

    =Sumx('Calendar',[Working Days]*[Active_Emps]*8)
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    12-28-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    7

    Re: DAX - SUMPRODUCT Help

    Quote Originally Posted by Bo_Ry View Post
    Maybe try

    =Sumx('Calendar',[Working Days]*[Active_Emps]*8)
    Dear Bo_Ry you just made my day!

    Thanks to all for the assistance!

    Cheers!

  12. #12
    Registered User
    Join Date
    12-28-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    7

    Re: DAX - SUMPRODUCT Help

    What if you need you need to replace the part of multiplying straight with a number and instead using a column value of the contractual hours per employee?


    Instead of :
    =Sumx('Calendar',[Working Days]*[Active_Emps]*8)

    Having Something like :
    =Sumx('Calendar',[Working Days]*[Active_Emps]*[Daily_Hours_Of_Emp])

    Would i need to create another measure that would just sum my new [Daily_Hours_Of_Emp] calculated column, maybe?

+ 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. [SOLVED] Sumproduct with multiple variants - Help! I'm a newbie to sumproduct
    By KIGeorge in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-16-2019, 01:21 AM
  2. Combine sumif/sumproduct or sumproduct with multiple criteria
    By sab128 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2018, 08:25 AM
  3. Count SUMPRODUCT Members / Average of SUMPRODUCT
    By Shingaru in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2014, 03:59 PM
  4. Replies: 1
    Last Post: 05-19-2012, 02:54 AM
  5. Replies: 5
    Last Post: 04-20-2012, 08:54 AM
  6. Replies: 6
    Last Post: 03-09-2011, 08:01 AM
  7. Using a SumProduct Count to find a SumProduct Total?
    By XL021710 in forum Excel General
    Replies: 3
    Last Post: 02-18-2010, 08:31 AM

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