Forum Discussion

evgeniam's avatar
evgeniam
Frequent Visitor
6 years ago
Solved

Incorrect DAX Measure Totals in Table Visual

Hi Power BI Experts! I am calculating Revenue per Employee as the sum of revenue time entries in the database. In cases when employees leave the company, we want to discontinue adding their ti...
  • ImkeF's avatar
    6 years ago

    Hi evgeniam 

    I think that something along this line should get you going:

     

    Measure2 =
    SUMX (
        FILTER (
            'RevenueDetail',
            'RevenueDetail'[Date] <= CALCULATE ( MAX ( 'Employee'[TerminationDate] ) )
                || ISBLANK ( CALCULATE ( MAX ( 'Employee'[TerminationDate] ) ) )
        ),
        'RevenueDetail'[RateTimesHours]
    )
    

    The MAX(TerminationDate) has to be evaluated on a row-by-row-basis for the Total to calculate correctly.