cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Asma Frequent Visitor
Frequent Visitor

NOW() function

Hi, I want to add a column that indicate if the year is the current year, a previous year or next year , I have already a calender Table called Dates, so I tried this Dax function but it didn't work for me

 

YearSlice = IF('Dates'[Year]=YEAR(NOW()),"Current Year",'Dates'[Year] = YEAR(NOW())-1,"Previous Day",'Dates'[Year] = YEAR(NOW())+1,"Next Year"," ") 

 I am new at Power BI Dax Functions so please can someone help me 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: NOW() function

YearSlice = IF('Dates'[Year]=YEAR(NOW()),"Current Year",IF('Dates'[Year] = YEAR(NOW())-1,"Previous Year",IF('Dates'[Year] = YEAR(NOW())+1,"Next Year","Other Year"))) 

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

2 REPLIES 2
Super User
Super User

Re: NOW() function

YearSlice = IF('Dates'[Year]=YEAR(NOW()),"Current Year",IF('Dates'[Year] = YEAR(NOW())-1,"Previous Year",IF('Dates'[Year] = YEAR(NOW())+1,"Next Year","Other Year"))) 

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Asma Frequent Visitor
Frequent Visitor

Re: NOW() function

Thank you  @Greg_Deckler  for your help

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 63 members 1,333 guests
Please welcome our newest community members: