Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Nested IF with current year

Guys I need IF statement in M based on this example table:

 The logic is:
when [Column1]="Value1" or [Column1]="Value2" or [Column1]="Value3" then 1
when [Column1]="Value4" and Date is in current year then 1
else 0

 

  • Hi Anonymous 

    = if [Column1]="Value1" or [Column1]="Value2" or [Column1]="Value3" then 1
    else if [Column1]="Value4" and Date.Year([Date]) = Date.Year(DateTime.LocalNow()) then 1
    else 0

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

1 Reply

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous 

    = if [Column1]="Value1" or [Column1]="Value2" or [Column1]="Value3" then 1
    else if [Column1]="Value4" and Date.Year([Date]) = Date.Year(DateTime.LocalNow()) then 1
    else 0

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers