This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
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
Solved! Go to Solution.
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 ,
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.
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
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.
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.
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 29 | |
| 28 | |
| 25 | |
| 20 | |
| 14 |
| User | Count |
|---|---|
| 53 | |
| 47 | |
| 27 | |
| 20 | |
| 19 |