Forum Discussion
Syntax Error in list
- Anonymous6 years ago
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 ,
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
- v-lid-msft6 years agoCommunity Support
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.