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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
taurius2022
Frequent Visitor

Create column based on multiple criterias

Hi all, 

 

I have a dataset with a following structure.

I want to insert a conditional column which would say: if kwh = o and duration > 2, then tell "bad", otherwise "ok"

 

Clientskwhduration
a00
b00
c1015
d0589
e5510
f014
g210
h110
i03

 

 

I have tried multiple options from conditional columns, to DAX as well as creating a column. 

Nothing works for me.

 

Power BI Forums were of no help to me.

 

Thanks and BR

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @taurius2022 

Please try formula as below:

Calculated column:

Column = if('Table'[kwh]=0&&'Table'[duration]>2,"bad","ok")

Meaure:

Measure = if(MAX('Table'[kwh])=0&&MAX('Table'[duration])>2,"bad","ok")

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
v-easonf-msft
Community Support
Community Support

Hi, @taurius2022 

Please try formula as below:

Calculated column:

Column = if('Table'[kwh]=0&&'Table'[duration]>2,"bad","ok")

Meaure:

Measure = if(MAX('Table'[kwh])=0&&MAX('Table'[duration])>2,"bad","ok")

Best Regards,
Community Support Team _ Eason

Calculated column (had this before) : DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values. --> #Error

 

Measure: 

taurius2022_0-1657018814630.png

 

I have changed the format of data --> kwh : from text to numers.

Now it works. 

Thanks

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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