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
rdvasisht
Frequent Visitor

using minus sign with a measure when creating a calculated column using if stmt

I need to create a column in Power BI using following criteria. Any assistance is appreciated.

What I need: I need to compare a column with a measure and get 1 or 0. The measure must be in negative.

I tried to add minus sign in front of measure but it does not give me the value that should be in the new col that I am creating. I also tried to create the measure by multiplying it with -1 to get negative measure. I get the negative measure, but when I use that measure to create the col it does not yield me the right values.

Can you please tell me how I can add a "-" minus sign and have the right value in the created column.

for e.g.

Task Revenue NEW_COL
-A-301
-B-200
-C101
-A300
-B501
-C-20

A measure value that I have = a_measure = 27.58

Above table is what I get when I apply -- This does not work: col_name = IF(table1[Revenue]<=(-[a_measure]),"1","0")

 

Task Revenue NEW_COL
-A-301
-B-200
-C100
-A300
-B500
-C-20

Above is the col I get when I apply following -- This works: col_name = IF(table1[Revenue]<=(-27.58),"1","0")

 

These do not work: col_name = IF(table1[Revenue]<=-([a_measure]),"1","0")

col_name = IF(table1[Revenue]<=(-[a_measure]),"1","0")

col_name = IF(table1[Revenue]<=(-1*([a_measure])),"1","0")

 

I need to use the measure in the formula as the value in the measure is subject to change. the 2nd table is what i need by using the -ve measure.

 

any comment or suggestion is appreciated. 

1 REPLY 1
MFelix
Super User
Super User

Hi @rdvasisht 

 

You cannot use metrics in a column in a dynamic way, since when you use measure this is based on context, and using it in a column.

 

In this case you need to create a measure for the column value, what is the purpose of this calculated column?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.