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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Conditional colomn in query editor

Dear, 

 

I have an issue where we work with a lot of different zone types. Now i want to narrow these down to just 3 option so i think i have to add an extra colomn in the query editor. However i have no experience with the DAX formula's etc. 

 

The 2 options are "Koel/vries" and "Ambient"

 

The following zones should all result in the kolomn calculating "Koel/vries":

+2°C +8°C

-20°C -25°C

-35°C -45°C

-65°C -85°C

-70°C -90°C

BHSC

BHSDGC

Bonded Cool

BRICS

CD2 +2°C +8°C

COOL_AND_FREEZE

CY +2°C +8°C

DG1 +2°C +8°C

DG1 -65°C -85°C

DG3 +2°C +8°C

HS +2°C +8°C

KROON_ZONE

 

The following zones should all result in the kolomn calculating "Ambient":

+15°C +25°C

BHSA

Bonded Ambient

BONDED_AND_AMBIENT

CD +15°C +25°C

CY +15°C +25°C

DG1 +15°C +25°C

DG2 +15°C +25°C

DG3 +15°C +25°C

HI +15°C +25°C

HS +15°C +25°C

 

Everything else should result in "onbekend"

 

Hopefully you can help

 

BR Kevin

1 ACCEPTED SOLUTION
Sahir_Maharaj
Super User
Super User

Hello @Anonymous,

 

Can you please add a new column and use the following formula in the "Custom column formula" section:

if Text.Contains([Zone Type], "+2°C +8°C") or 
   Text.Contains([Zone Type], "-20°C -25°C") or
   Text.Contains([Zone Type], "-35°C -45°C") or
   Text.Contains([Zone Type], "-65°C -85°C") or
   Text.Contains([Zone Type], "-70°C -90°C") or
   Text.Contains([Zone Type], "BHSC") or
   Text.Contains([Zone Type], "BHSDGC") or
   Text.Contains([Zone Type], "Bonded Cool") or
   Text.Contains([Zone Type], "BRICS") or
   Text.Contains([Zone Type], "CD2 +2°C +8°C") or
   Text.Contains([Zone Type], "COOL_AND_FREEZE") or
   Text.Contains([Zone Type], "CY +2°C +8°C") or
   Text.Contains([Zone Type], "DG1 +2°C +8°C") or
   Text.Contains([Zone Type], "DG1 -65°C -85°C") or
   Text.Contains([Zone Type], "DG3 +2°C +8°C") or
   Text.Contains([Zone Type], "HS +2°C +8°C") or
   Text.Contains([Zone Type], "KROON_ZONE") 
   then "Koel/vries"
else if Text.Contains([Zone Type], "+15°C +25°C") or
        Text.Contains([Zone Type], "BHSA") or
        Text.Contains([Zone Type], "Bonded Ambient") or
        Text.Contains([Zone Type], "BONDED_AND_AMBIENT") or
        Text.Contains([Zone Type], "CD +15°C +25°C") or
        Text.Contains([Zone Type], "CY +15°C +25°C") or
        Text.Contains([Zone Type], "DG1 +15°C +25°C") or
        Text.Contains([Zone Type], "DG2 +15°C +25°C") or
        Text.Contains([Zone Type], "DG3 +15°C +25°C") or
        Text.Contains([Zone Type], "HI +15°C +25°C") or
        Text.Contains([Zone Type], "HS +15°C +25°C") 
   then "Ambient"
else "onbekend"

This checks each zone type value against the criteria using the Text.Contains function.

 

Do not hesitate to let me know if you might need further assistance. 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

1 REPLY 1
Sahir_Maharaj
Super User
Super User

Hello @Anonymous,

 

Can you please add a new column and use the following formula in the "Custom column formula" section:

if Text.Contains([Zone Type], "+2°C +8°C") or 
   Text.Contains([Zone Type], "-20°C -25°C") or
   Text.Contains([Zone Type], "-35°C -45°C") or
   Text.Contains([Zone Type], "-65°C -85°C") or
   Text.Contains([Zone Type], "-70°C -90°C") or
   Text.Contains([Zone Type], "BHSC") or
   Text.Contains([Zone Type], "BHSDGC") or
   Text.Contains([Zone Type], "Bonded Cool") or
   Text.Contains([Zone Type], "BRICS") or
   Text.Contains([Zone Type], "CD2 +2°C +8°C") or
   Text.Contains([Zone Type], "COOL_AND_FREEZE") or
   Text.Contains([Zone Type], "CY +2°C +8°C") or
   Text.Contains([Zone Type], "DG1 +2°C +8°C") or
   Text.Contains([Zone Type], "DG1 -65°C -85°C") or
   Text.Contains([Zone Type], "DG3 +2°C +8°C") or
   Text.Contains([Zone Type], "HS +2°C +8°C") or
   Text.Contains([Zone Type], "KROON_ZONE") 
   then "Koel/vries"
else if Text.Contains([Zone Type], "+15°C +25°C") or
        Text.Contains([Zone Type], "BHSA") or
        Text.Contains([Zone Type], "Bonded Ambient") or
        Text.Contains([Zone Type], "BONDED_AND_AMBIENT") or
        Text.Contains([Zone Type], "CD +15°C +25°C") or
        Text.Contains([Zone Type], "CY +15°C +25°C") or
        Text.Contains([Zone Type], "DG1 +15°C +25°C") or
        Text.Contains([Zone Type], "DG2 +15°C +25°C") or
        Text.Contains([Zone Type], "DG3 +15°C +25°C") or
        Text.Contains([Zone Type], "HI +15°C +25°C") or
        Text.Contains([Zone Type], "HS +15°C +25°C") 
   then "Ambient"
else "onbekend"

This checks each zone type value against the criteria using the Text.Contains function.

 

Do not hesitate to let me know if you might need further assistance. 


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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