cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kumarcy
Helper II
Helper II

Power Query If condition

Hello Power Users,

I'm trying to write some multiple if statements in Query editor(Power query) but i'm not able to get the correct answer.  I have written below syntax but i'm missing something.  else if then else if line is not working properly.

Syntax:
if [Column A] = "ABCD" then [Start Date]
        else if [Column A] = "BCFD" then [Start Date]
  else if [Column A] = "QWER" then [Submission Date]
  else if [Column A] = "IUYT" then
                                            each if [Column B] = "lkjh" then [Submission Date]
                                            else if [Column B] = "hygt" then [End Date]
                                            else if [Column B] = "bgfd" then [End Date"]
                                            else null           
  else [#End Date"]

 

Please help me.

 

Thanks,

1 ACCEPTED SOLUTION
Mikelytics
Resolver III
Resolver III

Hi @Kumarcy ,

 

Can you try thw folloing please?

 

if [Column A] = "ABCD" then [Start Date]
        else if [Column A] = "BCFD" then [Start Date]
  else if [Column A] = "QWER" then [Submission Date]
  else if [Column A] = "IUYT" then
                                            (if [Column B] = "lkjh" then [Submission Date]
                                            else if [Column B] = "hygt" then [End Date]
                                            else if [Column B] = "bgfd" then [End Date"]
                                            else null)           
  else [#End Date"]

 

 Best regards

Mikelytics

 

Did I solve your request? Please mark my post as solution.

 

Appreciate your Kudos.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Kumarcy 

Have you tried solutions in above replies? If you have solved it, kindly accept the appropriate reply as the solution or post your own solution. If not, can you share more info about how it is going now so that we can help further. Thanks.

Mikelytics
Resolver III
Resolver III

Hi @Kumarcy ,

 

Can you try thw folloing please?

 

if [Column A] = "ABCD" then [Start Date]
        else if [Column A] = "BCFD" then [Start Date]
  else if [Column A] = "QWER" then [Submission Date]
  else if [Column A] = "IUYT" then
                                            (if [Column B] = "lkjh" then [Submission Date]
                                            else if [Column B] = "hygt" then [End Date]
                                            else if [Column B] = "bgfd" then [End Date"]
                                            else null)           
  else [#End Date"]

 

 Best regards

Mikelytics

 

Did I solve your request? Please mark my post as solution.

 

Appreciate your Kudos.

View solution in original post

darentengmfs
Super User I
Super User I

@Kumarcy 

 

Hi, do you have a typo in your syntax? Please take a look at what you posted.

darentengmfs_0-1611177854893.png

Also, I think you have an extra "else statement" at the end. 

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.