Forum Discussion

khisla's avatar
khisla
Helper II
1 year ago
Solved

Calculate Total - Wrong Total Sum

Hello All-

 

I need to calculate the total hours worked by employees on a particular date AND specific store.

See data below and expected total hours column calculated.

 

DateStoreEmployee #Hours WorkedTotal Hours
01/04/2025IL2072084683557.7242.25
01/04/2025IL2072114531967.942.25
01/04/2025IL2072141446697.5742.25
01/04/2025IL2072163508764.9342.25
01/04/2025IL2072163508847.6842.25
01/04/2025IL2073317250856.4542.25
01/04/2025IL2132088415027.613.32
01/04/2025IL2133278772395.7213.32
02/04/2025IL2142065384156.2267.93
02/04/2025IL2142094572908.267.93
02/04/2025IL214212804512867.93
02/04/2025IL2142130311316.367.93
02/04/2025IL2142137640796.267.93
02/04/2025IL2143143781348.2767.93
02/04/2025IL2143190617506.0767.93
02/04/2025IL2143278258246.2567.93
02/04/2025IL2143284065746.467.93
02/04/2025IL2143457072106.0267.93

 

I tried the below however an getting the wrong total sum

Total Hours =
CALCULATE(
    SUM(Table[Hours Worked]),
    ALLEXCEPT(Table, Table[Date], HILAN[Store])
)
 
Can someone help with a DAX formula.
Thanks!
  • Hi,

    Please check the below picture and the attached pbix file.

    It is for creating a calculated column.

     

     

     

    CC Total Hours = 
    VAR _date = Data[Date]
    VAR _store = Data[Store]
    VAR _t =
        FILTER ( Data, Data[Date] = _date && Data[Store] = _store )
    RETURN
        SUMX ( _t, Data[Hours Worked] )

4 Replies

  • Hi,

    Please check the below picture and the attached pbix file.

    It is for creating a calculated column.

     

     

     

    CC Total Hours = 
    VAR _date = Data[Date]
    VAR _store = Data[Store]
    VAR _t =
        FILTER ( Data, Data[Date] = _date && Data[Store] = _store )
    RETURN
        SUMX ( _t, Data[Hours Worked] )
    • khisla's avatar
      khisla
      Helper II

      Got the same result as my DAX which is incorrect.  The expected total hours vary

       

      DateStoreEmployee #Hour WorkedTotal Hours
      01/04/2025IL2072084683557.7281.99
      01/04/2025IL2072114531967.981.99
      01/04/2025IL2072141446697.5781.99
      01/04/2025IL2072163508764.9381.99
      01/04/2025IL2072163508847.6881.99
      01/04/2025IL2073317250856.4581.99
      01/04/2025IL2132088415027.613.32
      01/04/2025IL2133278772395.7213.32
      02/04/2025IL2142065384156.2276.01
      02/04/2025IL2142094572908.276.01
      02/04/2025IL214212804512876.01
      02/04/2025IL2142130311316.376.01
      02/04/2025IL2142137640796.276.01
      02/04/2025IL2143143781348.2776.01
      02/04/2025IL2143190617506.0776.01
      02/04/2025IL2143278258246.2576.01
      02/04/2025IL2143284065746.476.01
      02/04/2025IL2143457072106.0276.01
    • khisla's avatar
      khisla
      Helper II
      DateStoreEmployee #Hour WorkedTotal Hours
      01/04/2025IL2072084683557.7281.99
      01/04/2025IL2072114531967.981.99
      01/04/2025IL2072141446697.5781.99
      01/04/2025IL2072163508764.9381.99
      01/04/2025IL2072163508847.6881.99
      01/04/2025IL2073317250856.4581.99
      01/04/2025IL2132088415027.613.32
      01/04/2025IL2133278772395.7213.32
      02/04/2025IL2142065384156.2276.01
      02/04/2025IL2142094572908.276.01
      02/04/2025IL214212804512876.01
      02/04/2025IL2142130311316.376.01
      02/04/2025IL2142137640796.276.01
      02/04/2025IL2143143781348.2776.01
      02/04/2025IL2143190617506.0776.01
      02/04/2025IL2143278258246.2576.01
      02/04/2025IL2143284065746.476.01
      02/04/2025IL2143457072106.0276.01