Forum Discussion

shirinshon's avatar
shirinshon
New Member
1 year ago
Solved

MTD calculation with condition

Hello,   I'm trying to calcualte MTD Earned Hours depending on the country. I have a table called Earned Hours Report which has columns such as site_ref, Standard Earned Hours etc. For example I wa...
  • rohit1991's avatar
    1 year ago

    Use this corrected DAX formula:

    Key Fix:

    • Wrapped the condition 'EH Daily Report'[site_ref] = "USA" inside CALCULATE to apply it as a filter.
    Earned Hours MTD USA = 
    CALCULATE(
        TOTALMTD(SUM('EH Daily Report'[Standard earned hours]), DimDate[Date]),
        'EH Daily Report'[site_ref] = "USA"
    )

     

  • ToddChitt's avatar
    1 year ago

    Have you tried something like this to get just the USA component:

    Earned Hours USA = CALCULATE (SUM ( [earnedHours] ), [Country] = "USA" )

    Then using that in something like this:

    MTD Earned Hours USA = TOTALMTD ( [Earned Hours USA], Dates[Date] )