Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Transformation : Last Month Flag

Hi,

 

I am trying to make flag of Last month,but unable to do so. How can i create a column with flag T/F  against Last month

 

S.NOUserDate
1A11-Jun-20
2A219-Jul-20
3a312-Jul-20
   

 

Out put should be like : 

 

S.NOUserDateFlag
1A11-Jun-20N
2A219-Jul-20Y
3a312-Jul-20Y

3 Replies

  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    Community Support

    Hi Anonymous ,

     

    Do you want to add a column to distinguish the last month and current month?

    If yes, you can refer the following formula.

     

    Flag = 
    var _current_month = MONTH(TODAY())
    var _month = MONTH('Table'[Date])
    return
    IF(
        _month=_current_month,
        "Y",
        IF(
            _month=_current_month-1,
            "N","Other"
            )
        )

     

     

    If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

     

    Best regards,

     

    Community Support Team _ zhenbw

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    BTW, pbix as attached.