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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Resident Rockstar
Resident Rockstar

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.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

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
Resident Rockstar
Resident Rockstar

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.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
darentengmfs
Post Prodigy
Post Prodigy

@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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.