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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
KelvinMorel
Helper II
Helper II

DAX - ROUND with IF statement

Hi,

 

I'm having an odd issue, to display the "+" or "-" signs on my measure result I have a quite straight forwards IF statement

ValueTendens= 
VAR RESU = ROUND(([VALUE1]-[VALUE2]);0)
RETURN IF(RESU>0;"+"&RESU;RESU)

The thing is when the result is positive it displays as expected, a rounded number (+4) but when the result is negative it displays not rounded (-3,1212).

 

I don't get it.

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

hi @KelvinMorel 

try include RESU into format. it looks like data types issue

ValueTendens = 
VAR RESU = ROUND(([VALUE1]-[VALUE2]);0)
RETURN IF(RESU>0;"+"&RESU;format(RESU;""))

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
KelvinMorel
Helper II
Helper II

Hi,

 

I'm sorry, just found a workaround, I guess:

ValueTendens= 
VAR RESU = ROUND(([VALUE1]-[VALUE2]);0)
RETURN IF(RESU>0;"+"&RESU;""&RESU)

 I'm still not understanding why, any explanation it's welcome.

az38
Community Champion
Community Champion

hi @KelvinMorel 

try include RESU into format. it looks like data types issue

ValueTendens = 
VAR RESU = ROUND(([VALUE1]-[VALUE2]);0)
RETURN IF(RESU>0;"+"&RESU;format(RESU;""))

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors