Forum Discussion
Jay2022
2 years agoHelper IV
IF &&&&
I'm trying to add a new column but keep getting an error message that the syntax is incorrect
Before April 2024 =
IF('Table'[Order Date]>"30/03/2024"
&& ('Table'[Store]=Store A,"Before April 2024","No"))
I'd also want to follow this with all store C's regardless of Order Date are Before April 2024
Any help greatly appreciated
Jay2022 If 'Table'[Order Date] is in date format, try this
Before April 2024 =IF('Table'[Order Date]> DATE(2024, 03, 30)&& ('Table'[Store]=Store A),"Before April 2024","No")
The reason for error is the date is written as "30/03/2024" which makes it a string and thus can't be compared with a date column.
4 Replies
- ChiragGarg2512Solution Sage
Jay2022 , There is a need to change the formula as the open bracket is not at the correct place.
Try,Before April 2024 =IF('Table'[Order Date]>"30/03/2024"&& ('Table'[Store]=Store A),"Before April 2024","No")- Jay2022Helper IV
Thank you but its not working i'm getting the following error message
DAX comparison operations do not support comparing values of type Date with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.
- ChiragGarg2512Solution Sage
Jay2022 If 'Table'[Order Date] is in date format, try this
Before April 2024 =IF('Table'[Order Date]> DATE(2024, 03, 30)&& ('Table'[Store]=Store A),"Before April 2024","No")
The reason for error is the date is written as "30/03/2024" which makes it a string and thus can't be compared with a date column. - Jay2022Helper IV
Brilliant Thank you for your help