Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Error with the year change

Hello,

I am getting the below error when refreshing a report with data that includes dates from 2022.

TAPP_0-1641294889068.png

How would I modify the formula to include 2022 with the same principle, like =IF(OR in excel?

TAPP_1-1641294960795.png

Many thanks!

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

You could make it 

IF(YEAR >= 2021, ... 

then it'll work for 2023 too.

 

DAX does have an OR function.  If you want to use that then it would be

IF(OR(YEAR = 2021, YEAR = 2022), ...

 

Incidentally, is Week of Year a column name?  The syntax error is coming from there.  You should reference a column name like this

'Table Name'[Column Name]

View solution in original post

3 REPLIES 3
VahidDM
Super User
Super User

Hi @Anonymous 

 

As @PaulOlding mentioned, you can use below for including 2022:

IF(YEAR >= 2021

IF(OR(YEAR = 2021, YEAR = 2022), 

IFYEAR = 2021 || YEAR = 2022,

 

and the error is for that Week of Year, if that is the column name and you want to create measure, you need to use it in [ ] with an aggregation formula, like MAX(table[Week of Year]), otherwise, if that is a measure, you need to use it in [ ] lke this [Week of Year], but if you want to create a calculated column you can just use the table[Week of Year] in your formula.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

You could make it 

IF(YEAR >= 2021, ... 

then it'll work for 2023 too.

 

DAX does have an OR function.  If you want to use that then it would be

IF(OR(YEAR = 2021, YEAR = 2022), ...

 

Incidentally, is Week of Year a column name?  The syntax error is coming from there.  You should reference a column name like this

'Table Name'[Column Name]

Anonymous
Not applicable

Thanks a lot @PaulOlding !

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors