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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Syntax Error in list

Hi All,

Need your Help....for DAX Statement

Trying to list some countries I want and show one thing if true, and another thing if false.

Below gives an syntax error

= Table.AddColumn(Custom1, "DayLink", each If [Year] IN ({“January", "February", "March", "April", "June", "July", "August", "September"}) then [Year] & [Day] else [Year])

hard way.....i got

= Table.AddColumn(#"Changed Type", "DayLink", each if [Year] = "January" then [Year] & [Day]

else if [Year] = "February" then [Year] & [Day]

else if [Year] = "March" then [Year] & [Day]

else if [Year] = "April" then [Year] & [Day]

else if [Year] = "May" then [Year] & [Day]

else if [Year] = "June" then [Year] & [Day]

else if [Year] = "July" then [Year] & [Day]

else if [Year] = "August" then [Year] & [Day]

else if [Year] = "September" then [Year] & [Day]

else [Year]

DAX syntax for IN a list of values

 

Thanks & Regards,

Sam

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Dong,

 

Thanks for the reply...

 

Am getting data type error message when using List.Contains

 

= Table.AddColumn(#"Changed Type1", "Custom", each if List.Contains({“January", "February", "March", "April", "June", "July", "August", "September"},[Year])  then [Year] & [Day] else [Year])

 

"Expression.Error: 10 arguments were passed to function which expects between 2 and 3. Details: Pattern= Arguments=List

 

Regards,

Sam

View solution in original post

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

Your formula is Power Query M formula and "IN" function is DAX function. We can change your formula to following to meet your requirement.

 

 

= Table.AddColumn(#"Changed Type1", "Custom", each if Text.Contains("January February March April June July August September",[Year])  then [Year] & [Day] else [Year])

https://docs.microsoft.com/zh-cn/powerquery-m/text-contains

 

Or

 

= Table.AddColumn(#"Changed Type1", "Custom", each if List.Contains({“January", "February", "March", "April", "June", "July", "August", "September"},[Year])  then [Year] & [Day] else [Year])

https://docs.microsoft.com/zh-cn/powerquery-m/list-contains

 

 

6.PNG

 

 

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Dong,

 

Thanks for the reply...

 

Am getting data type error message when using List.Contains

 

= Table.AddColumn(#"Changed Type1", "Custom", each if List.Contains({“January", "February", "March", "April", "June", "July", "August", "September"},[Year])  then [Year] & [Day] else [Year])

 

"Expression.Error: 10 arguments were passed to function which expects between 2 and 3. Details: Pattern= Arguments=List

 

Regards,

Sam

Hi @Anonymous ,

 

Sorry for my mistake, use the following formula:

 

= Table.AddColumn(#"Changed Type1", "Custom", each if List.Contains({{“January"}, {"February"},{ "March"}, {"April"},{ "June"},{ "July"}, {"August"},{ "September"}},[Year])  then [Year] & [Day] else [Year])

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.