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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Is there a way to allow .10 difference when comparing decimal numbers for equality

Is there any function in DAX that will allow a .10 difference for decimal numbers when comparing for equality?

For example, I have 2 calculated measures (decimal numbers) and I would like to return the below results:

 

M1 = 136.50

M2 = 136.40

result= IF (M1=M2, yes, no)

 

Output: Yes for the above values.

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Nevermind, I got the solution

Status=
var subr = ABS(M1-M2)
var result = IF(AND(subr >= 0.01 , subr <= 0.10) || M1= M2 ,"Yes", "No")
return result

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Nevermind, I got the solution

Status=
var subr = ABS(M1-M2)
var result = IF(AND(subr >= 0.01 , subr <= 0.10) || M1= M2 ,"Yes", "No")
return result

 

Hi @Anonymous 

Can you post the solution here.





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
pranit828
Community Champion
Community Champion

HI @Anonymous 

Try

result= IF (M1=M2+0.10 || M1=M2-0.10, yes, no)





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
smpa01
Super User
Super User

IF (M1=M2+0.10, yes, no)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Anonymous
Not applicable

I would like it to be dynamic since this will return "no" when numbers are the same and should return yes in that case.

for example, when both the measures are 136.50 then it should return yes as well. I would want it to return yes when:

They match

Also when there is a difference .10 (max) else return no

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.