cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
welyson205
Frequent Visitor

How to make comparisons with float in DAX?

Hi everyone, hope you are well 🙂

 

I'm trying to make a measurement that, depending on the daily variation, displays an icon for positive or negative.

But if the number the variation has decimal places (-0.05) does not work.

welyson205_0-1642770330467.png

 

Even with the negative number in percentage this occurs.

Does anyone have any idea what to do in these cases?

welyson205_1-1642770650496.png

thx

welyson205_0-1642775336241.png

 

1 ACCEPTED SOLUTION

Hi, @welyson205 

I checked your measure 'indicador base64' and found that you have offset the calendar table by one day.

DateADD(
    oCalendario[Date],
    -1,
    Day
)

8.png

You may need to remove this filter. The code in the SWITCH section  is sufficient for your needs.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

7 REPLIES 7
Thejeswar
Resident Rockstar
Resident Rockstar

Hi @welyson205 ,

Usually defining Indicators should be done on the Number and not on the percentage.

i.e. Control the display of Indicator using the Number by keeping the value as a number datatype and just  for display make the number as percentage

 

May be this could solve this issue!!

welyson205_0-1642775312140.png

 

Hi, @welyson205 

I checked your measure 'indicador base64' and found that you have offset the calendar table by one day.

DateADD(
    oCalendario[Date],
    -1,
    Day
)

8.png

You may need to remove this filter. The code in the SWITCH section  is sufficient for your needs.

 

Best Regards,
Community Support Team _ Eason

Thx ❤️

If you notice in the first image my attempt is with decimal number

amitchandak
Super User
Super User

@welyson205 , Try to use unichar like this, see if that can help

 

/////Arrow
Arrow =
var _change =[Net Sales YTD]-[Net Sales LYTD]
return
SWITCH (
TRUE(),
_change > 0, UNICHAR(9650),
_change = 0, UNICHAR(9654),
_change < 0, UNICHAR(9660)
)


/////Arrow Color , use in conditional formatting using field value option


Arrow color =
var _change =[Net Sales YTD]-[Net Sales LYTD]
return
SWITCH (
TRUE(),
_change > 0, "green",
_change = 0, "blue",
_change < 0, "red"
)

 

UNICHAR - Tool for Custom Icon Formatting: https://www.youtube.com/watch?v=veCtfP8IhbI&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=50

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!

Thanks for replying, my icon works fine, my problem is with the values ​​in the comparison. Note that the value is negative but the icon points to positive! I believe it is a problem with decimal numbers since this only happens when the value has places to the right (-0.05, -0.065, ...)

welyson205_0-1642774102619.png

 

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!