cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Power Participant
Power Participant

Query Editor vs Dax column

Hello Community - I would like to do this in the query editor, but have the DAX reference as well for learning. 

 

We have Orders.   These orders begin with a prefix, like HS, AR, CO, etc.   

 

The HS and AR orders, below $40k value, are part of a particular sales channel.   I would like the custom column to return the value "QuickShip" if the Order prefix begins with either HS or AR, and if the Order value is equal or less than $40k.  

 

texmexdragon_0-1607540582729.png

 

1 ACCEPTED SOLUTION
Super User III
Super User III

Hi @texmexdragon 

Here's a sample PBIX file with the following data and code.

Based on this sample data

sample-data.png

This will do the job

 

 

= if (Text.Start([Order],2) = "HS" or Text.Start([Order],2) = "AR") 

and [Shipped Price] <= 40000 

then "QuickShip" 

else null

 

 

Producing this output

new-column.png

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
Power Participant
Power Participant

Thanks Phil  -  This was awesome and just what I needed!

 

 

Super User III
Super User III

Hi @texmexdragon 

Here's a sample PBIX file with the following data and code.

Based on this sample data

sample-data.png

This will do the job

 

 

= if (Text.Start([Order],2) = "HS" or Text.Start([Order],2) = "AR") 

and [Shipped Price] <= 40000 

then "QuickShip" 

else null

 

 

Producing this output

new-column.png

Regards

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Microsoft Ignite

Microsoft Ignite with Arun Ulag

Featured Session: Drive Data Culture with Power BI- Vision, Strategy & Roadmap. Register here https://myignite.microsoft.com #MSIgnite #PowerPlatform #Power BI ​

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

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.

Top Solution Authors
Top Kudoed Authors