cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ovetteabejuela Established Member
Established Member

Power Query: Check for a value(date) in three columns

Hi,

 

How do I use M to check for a value from multiple columns, in my case 3.

 

In my situation I am looking for a value in a specific order, say column 1 first, then column 2 and then 3. Whoever is non-empty, grab the value.

 

Something like

 

comment: with  Column X as placeholder

 

if ColumnA <> "" then

    ColumnX = ColumnA

else

      if ColumnB <> "" then

           ColumnX = ColumnB

       else

              if ColumnC <> "" then

                    ColumnX = ColumnC

              end if

        end if

end if

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Power Query: Check for a value(date) in three columns

Hi @ovetteabejuela,


You can add a custom column to use below formula to check different columns.

AddColumn = Table.AddColumn(#"Promoted Headers", "ColumnX", each if [ColumnA]<> null then [ColumnA] else if [ColumnB]<> null then [ColumnB] else if [ColumnC] <> null then [ColumnC] else null)

 

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Power Query: Check for a value(date) in three columns

Hi @ovetteabejuela,


You can add a custom column to use below formula to check different columns.

AddColumn = Table.AddColumn(#"Promoted Headers", "ColumnX", each if [ColumnA]<> null then [ColumnA] else if [ColumnB]<> null then [ColumnB] else if [ColumnC] <> null then [ColumnC] else null)

 

 

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |

View solution in original post

ovetteabejuela Established Member
Established Member

Re: Power Query: Check for a value(date) in three columns

@v-shex-msft,

 

Thanks, you beat me to it.. I did see some resource over the internet as well and this is definitely it, I'll just have to apply it and see how it goes but I think this is it.

 

Thanks again.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 36 members 860 guests
Please welcome our newest community members: