Forum Discussion

chavanr's avatar
chavanr
Icon for Resolver I rankResolver I
4 years ago
Solved

Add inactive date to a measure.

Hi there,   I have a requirement to add inactive date to a measure.   Please see below sample data for Table : Test     So here my "Added Date" is used to create relationship between the...
  • chavanr's avatar
    chavanr
    4 years ago

    Hi Anonymous 

     

    I created a variable for inactive 

    Occupancies =
    Var _max = EOMONTH(MAXX(ALLSELECTED('Calendar'),'Calendar'[Date]),-1)+15
    Var _cnt_active =
    CALCULATE(SUM(Test[Occupancies]),DATESYTD('Calendar'[Date]),
    'Calendar'[Date] <= _max)
    Var _cnt_active_return = IF(ISBLANK(_cnt_active),0,_cnt_active)

    Var _cnt_inactive =
    CALCULATE(SUM(Test[Occupancies]),DATESYTD('Calendar'[Date]),
    'Test'[InactiveDate] <= _max, Test[InactiveDate] <> BLANK () )
    Var _cnt_inactive_return = IF(ISBLANK(_cnt_inactive),0,_cnt_inactive)

    return _cnt_active_return - _cnt_inactive_return