Forum Discussion

Puja's avatar
Puja
Icon for Helper III rankHelper III
3 years ago
Solved

Previous Month Flag

Hi , I need some help with Previous month flag. When user selecta a date Ex: 3/1/2020, the result should be pevious month (2/1/2020)  Dates Test data. 1/1/2020 2/1/2020 3/1/2020 4/1/20...
  • FreemanZ's avatar
    3 years ago

    Hi Puja 

    1) create a table like:

    Table2 = Table1

    2) plot a table visual with Table1[Date] column and a measure like:

    Measure = 
    IF(
        SELECTEDVALUE(Table1[Date]) = EDATE(SELECTEDVALUE(Table2[Date]),-1),
        1,0
    )

    it worked like:

     

     

  • Jihwan_Kim's avatar
    3 years ago

    Hi, 

    I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.

     

     

     

    Expected result measure: =
    VAR _selectedmonthyear =
        MAX ( Data[Date_test] )
    VAR _selectedday =
        DAY ( _selectedmonthyear )
    VAR _prevendofmonthdate =
        EOMONTH ( _selectedmonthyear, -1 )
    RETURN
        DATE ( YEAR ( _prevendofmonthdate ), MONTH ( _prevendofmonthdate ), _selectedday )