The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi community,
I'm real new to powerBI and am getting this error in the following nested if statement:
Nested if statement:
= Table.AddColumn(#"Added Custom1", "Custom", each if [HRStreamDesc] <> "Nursing" then null else
if List.ContainsAny([BaseClass],{"AN","ANCSD"}) then "Assistant in Nursing" else null)
Error message I am receiving:
Expression.Error: We cannot convert the value "QNG6" to type List.
Details:
Value=QNG6
Type=[Type]
Any assistance on how to overcome this would be appreciated.
Basically I need to create a new column based on the value that exists in another column, should be a simple nested if statement...
Cheers
Carl
Solved! Go to Solution.
Hi @CarlBlunck ,
Please try:
if [HRStreamDesc]<>"Nursing" then null else if List.ContainsAny( {[BaseClass]},{"AN","ANCSD"}) then "Assistant in Nursing" else null
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @CarlBlunck ,
Please try:
if [HRStreamDesc]<>"Nursing" then null else if List.ContainsAny( {[BaseClass]},{"AN","ANCSD"}) then "Assistant in Nursing" else null
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous thanks so much! To help me understand, what does the addition of the {} brackets do to the [BaseClass] column?
Cheers
Carl
Hi @CarlBlunck ,
Please try this
Table.AddColumn(#"Added Custom1", "Custom", each try if [HRStreamDesc] <> "Nursing" then null else
if List.ContainsAny([BaseClass],{"AN","ANCSD"}) then "Assistant in Nursing" else null otherwise null)
Hi @mussaenda thanks - but I unfortunately get a "Token Eof expected" error and the otherwise statement is being highlighted.
@mussaenda ah I missed the inclusion of the each try if element. That got rid of the error but now everything is just coming back as a null...