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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
hatcher78
New Member

Use Field Data as Operator

I want have the operator used in a custom column be based on the data in another field but keep getting an error.

 

For example, my dataset has the following fields

Field A (The DataPoint)     Field B (The Measurement Type)     Field C- (The Threshold)

               3                                                   >                                             1   

I want to write a custom column formula that says:

If [Field A] [Field B] [Field C] then 1 else 0

 

The formula works if i type in > instead of using [Field B], however, some rows use another operator (like = or <). Is there a way to write the formula with the operator being [Field B]?

 

1 ACCEPTED SOLUTION

Hi @hatcher78 

 

But I have another idea how you can to it:

 

Measure =
SWITCH(
   SELECTEDVALUE([FieldB]),
   ">", IF([FieldA]>[FieldC],1,0),
   "<", IF([FieldA]<[FieldC],1,0),
   ">=", IF([FieldA]>=[FieldC],1,0),
   "<=", IF([FieldA]<=[FieldC],1,0)
)

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

View solution in original post

2 REPLIES 2
Mikelytics
Resident Rockstar
Resident Rockstar

Hi @hatcher78 

 

I really have never seen this anytime in any report so I would say it is not possible to transform a text field into an operator.

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Hi @hatcher78 

 

But I have another idea how you can to it:

 

Measure =
SWITCH(
   SELECTEDVALUE([FieldB]),
   ">", IF([FieldA]>[FieldC],1,0),
   "<", IF([FieldA]<[FieldC],1,0),
   ">=", IF([FieldA]>=[FieldC],1,0),
   "<=", IF([FieldA]<=[FieldC],1,0)
)

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.