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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Analitika
Post Prodigy
Post Prodigy

Error in Power Query in Power BI

Hello,

 

I am  getting error in this code 

 

Analitika_0-1653398568704.png

 

How to solve this?

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Analitika ,

 

I see that you are using the same logic for "Komtus" and "i osis verting bluras", then please try

 

 

If [Imone] = "Komtus" or [Imone] = "i osis verting bluras" then [Imone] & [zur2] else [zurnalas ir kodas]

 

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-kkf-msft
Community Support
Community Support

Hi @Analitika ,

 

I see that you are using the same logic for "Komtus" and "i osis verting bluras", then please try

 

 

If [Imone] = "Komtus" or [Imone] = "i osis verting bluras" then [Imone] & [zur2] else [zurnalas ir kodas]

 

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AntonioM
Solution Sage
Solution Sage

Starting on the first line, if you remove 'else [zurnalas ir kodas]' then that should work.

 

You need to always have 

if (condition) then (result) else if (condition 2) then (result 2) else if (condition 3)...

... else (final result)

 

My goal to concatenate two columns to one according to conditions. If name="ads" then a & b else a & c else if ..

Sure, so there in your example you would need something like 

If name = "ads" then a & b else 
if name = "   " then a & c else 
if ...

 

You always need IF - THEN - ELSE 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.