cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Nested IF with current year

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

Capture.JPG

 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

 

1 ACCEPTED SOLUTION
Super User III
Super User III

Hi @aleksandra_stan 

= 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 

SU18_powerbi_badge

 

View solution in original post

1 REPLY 1
Super User III
Super User III

Hi @aleksandra_stan 

= 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 

SU18_powerbi_badge

 

View solution in original post

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors