Forum Discussion

Analitika's avatar
Analitika
Icon for Post Prodigy rankPost Prodigy
4 years ago
Solved

Error in Power Query in Power BI

Hello,

 

I am  getting error in this code 

 

 

How to solve this?

  • 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.

4 Replies

  • AntonioM's avatar
    AntonioM
    Icon for Solution Sage rankSolution 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)

     

    • Analitika's avatar
      Analitika
      Icon for Post Prodigy rankPost Prodigy

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

      • AntonioM's avatar
        AntonioM
        Icon for Solution Sage rankSolution Sage

        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 

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity 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.