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
JayB
New Member

Problem using IF with new column (Syntax error)

Hello,

 

I'm following this guide ( https://insightsoftware.com/blog/working-with-weeks-in-power-bi/ ) to get week numbers, day numbers and names for my dataset. I'm able to add 2 new columns for the week/day numbers just like in the guide.
I'm failing at the step to add the day names column.

I'm adding the column with the following code:

 

Day Name = IF('123it_otrs time_accounting'[Week Day]=1,"Monday",
IF('123it_otrs time_accounting'[Week Day]=2, "Tuesday",
IF('123it_otrs time_accounting'[Week Day]=3, "Wednesday",
IF('123it_otrs time_accounting'[Week Day]=4, "Thursday",
IF('123it_otrs time_accounting'[Week Day]=5, "Friday",
IF('123it_otrs time_accounting'[Week Day]=6, "Saturday", "Sunday"))))))

 

 and I'm getting the following error:

 

The syntax for '"Monday"' is incorrect. (DAX(IF('123it_otrs time_accounting'[Week Day]=1."Monday",IF('123it_otrs time_accounting'[Week Day]=2. "Tuesday",IF('123it_otrs time_accounting'[Week Day]=3. "Wednesday",IF('123it_otrs time_accounting'[Week Day]=4. "Thursday",IF('123it_otrs time_accounting'[Week Day]=5. "Friday",IF('123it_otrs time_accounting'[Week Day]=6. "Saturday", "Sunday")))))))).

 

 

I'm not sure wher I'm going wrong and I'm starting to think the issue is that I have to use ' ' to access my columns?

 

14 REPLIES 14

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