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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Nicki
Helper III
Helper III

how to create a column to subtract a measure from a column

I have a column in  [table A] that has the value of Duration and it is integer. 

The value of slicer is calcuated  as a measure:

        Measureslicer = VALUE(MAX(tableB[DURATION])) 

Then,  I need to have a column for my chart.

new column= if (TableA[Duration] - Measureslicer >1 ,1,0)

It does not work  and shows 0 for all rows.

For example, when Duration  is  3  and Measureslicer  is  11 ,

If I assign Measureslicer to a  column  and it will be 30840 instead of 11 but I can see the correct value of measure "11" as a measure. because of this reason subtract and if statement does not work.  

In fact, the value of measure is not correct when assign to a column or  doing subtract.

 

Thank you in advance for help.

6 REPLIES 6
ccakjcrx
Resolver I
Resolver I

Hey @Nicki!

 

You reference two tables in your post. Do you have two tables, or one? If you have one table, the if statement is working correctly.

 

The measure returns the maximum value from the column.

 

The if statement then subtracts the maximum value (generated from the measure) from each value in the duration column; this won't produce a value greater than 1. Given the if statement is set up to return 0 if duration - max duration < 1, you should get a zero in each row under your new calculated column.

Thanks.

How can I use the selected value of slicer?

In this case, I do not need to put the max(duration) from slicer.

the slicer is  "less than or equal to"  and I need the second value.

 

MDuration is a measure in [DurationTable] that includes the selected value of  the slicer.  For example for duration= 100  , new column must be 1 but it is zero. 

I can show in an image and It does not work,image1.JPG

did you used the DAX I provided.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes.

parry2k
Super User
Super User

new column =
var myMeasure = [measureslicer]
return if(Table[Duration] - myMeasure > 1, 1, 0)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.