Forum Discussion

erhan_79's avatar
erhan_79
Post Prodigy
5 years ago
Solved

measure help

hi there 

 

i need your support about to create a measure 

 

you can see below rule about that measure 

 

i have date column , the measure must work beased on that column : 

 

if the date column is current month it will write "Actual Month "

if the date column is before than current month  it will write  " Previous Month "

if the date column is after  than current month  it will write  " Next  Month "

 

sample : 

 

Current Month : September

 

01.10.2019--Previous Month

01.05.2020--Previous Month

01.08.2020-Previous Month

10.10.2020-Next Month

10.01.2021-NExt Month 

 

6 Replies

  • erhan_79 , You can try like

    Month Type = Switch( True(),
    eomonth(Date[Date],0) = eomonth(Today(),0) ,"Current Month" , //This Month
    eomonth(Date[Date],0) < eomonth(Today(),0) && ,"Previous Month" , //last Month
    eomonth(Date[Date],0) > eomonth(Today(),0) && ,"Next Month" , //last Month
    [Month Year]
    )

    OR

    //Only one month

    Month Type = Switch( True(),
    eomonth(Date[Date],0) = eomonth(Today(),0) ,"Current Month" , //This Month
    eomonth(Date[Date],0) = eomonth(Today(),-1) && ,"Previous Month" , //last Month
    eomonth(Date[Date],0) =  eomonth(Today(),1) && ,"Next Month" , //last Month
    [Month Year]
    )

    • erhan_79's avatar
      erhan_79
      Post Prodigy

      hi amitchandak 

       

      thanks for your reply but , when i write your formula after "emonth" system does not accept table name "date[date]" , system wants start date as a date 

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        erhan_79 See attached PBIX below sig, Table (18)

        Column = 
            VAR __Min = DATE(YEAR(TODAY()),MONTH(TODAY()),1)
            VAR __Max = EOMONTH(__Min,0)
        RETURN
            SWITCH(TRUE(),
                [Date]<__Min,"Previous Month",
                [Date]>__Max,"Next Month",
                "Actual Month"
            )