Forum

If, then, concatena...
 
Notifications
Clear all

If, then, concatenate

4 Posts
3 Users
0 Reactions
92 Views
(@kesconsult)
Posts: 2
New Member
Topic starter
 

Hello,

I'm trying to determine if I can do this task via Power Query, or if I need to write the formula after I load.

 

I have columns of data (see attached if needed) with Lead Day, Trail Day and Day of the week.

This is what I want to achieve:

If the DayOfWeek is 1, 2, or 3, then it should be equal to LeadDay, and I want the cell to say YES.

If the DayOfWeek is 4, 5, or 6, then it should be equal to TrailDay, and I want the cell to say YES.

 

If that will not work, then I would want to try this:

If the DayOfWeek is 1, 2, or 3, CONCATENATE with LeadDay

If the DayOfWeek is 4, 5, or 6, CONCATENATE with TrailDay

 

Thanks for any help anyone has. Smile

 
Posted : 22/10/2016 4:51 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Nikki,

Thanks for your question. I've moved it to the Power Query MEMBERS group. This way I know you are a course member and will make sure you get a prompt reply.

Your file isn't attached. After clicking 'add files' you have to click 'start upload'.

That said, in session 6.13 of the Power Query course I cover IF OR formulas using the List.AnyTrue function. Have you watched that lesson?

If you're still stuck please try uploading your file again so I can give you a tailored answer.

Kind regards,

Mynda

 
Posted : 24/10/2016 7:06 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Nikki,

The formula is pretty simple, try to add a new column with this formula:

=if [DayOfWeek]<=3 then [LeadDay] else if [DayOfWeek]>3 then [TrailDay] else "null"

You can replace [LeadDay] with "YES" if you want, but make sure you don't replace [TrailDay] with "YES" also, from your message I understand that the cell should show a YES in both cases. Try "NO" for days > 3 🙂

 
Posted : 25/10/2016 2:02 am
(@kesconsult)
Posts: 2
New Member
Topic starter
 

Thank you Mynda and Catalin. I could not determine the best way to do this.

And thank you for moving the question to the members forum.

Nikki

 
Posted : 25/10/2016 4:11 pm
Share: