Forum Discussion
IF with text and numbers
- 7 years ago
OK, so first let's talk about the syntax first
What works for you is this:
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2,, 1,, 1 )
the thing is '2,' is atually the same as '2.' for me, or how '2,0' would be for you
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2,, 1,, 1 )
the red commas are a decimal separator, the blue ones are list separator. That's why this should work as well:
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2,0, 1,0, 1 )
As you use modified English settings, I'd suggest using the default option for decimal - the dot '.' and comma as list separator
now the logical problem with this IF (I will use '.' as decimal separator to make it more clear)
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2., 1., 1 )
it returns '1.' for TRUE and '1' for FALSE. Which is always 1 with whatever is the formatting in your column. You need to change one of the '1' to something that you want to see, like I posted earlier:
Test = IF ( ISBLANK ( PowerBI[DueBy] ), BLANK (), IF ( ISERROR ( VALUE ( PowerBI[SLA Alert] ) ), BLANK (), IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2 , 2 , 1 ) ) )'2' for TRUE and '1' for FALSE
Hi,
below my regional settings on my PC.
Below my regional settings on PowerBI
My PowerBI version is 2.71.5523.941 64-bit (July 2019)
Below a screenshot of the error
Indeed my "Decimal Separator" and "List separator" is the same ","
Would you suggest to change one of the two...and if yes which symbol should I use?
Thanks
OK, so first let's talk about the syntax first
What works for you is this:
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2,, 1,, 1 )
the thing is '2,' is atually the same as '2.' for me, or how '2,0' would be for you
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2,, 1,, 1 )
the red commas are a decimal separator, the blue ones are list separator. That's why this should work as well:
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2,0, 1,0, 1 )
As you use modified English settings, I'd suggest using the default option for decimal - the dot '.' and comma as list separator
now the logical problem with this IF (I will use '.' as decimal separator to make it more clear)
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2., 1., 1 )
it returns '1.' for TRUE and '1' for FALSE. Which is always 1 with whatever is the formatting in your column. You need to change one of the '1' to something that you want to see, like I posted earlier:
Test = IF (
ISBLANK ( PowerBI[DueBy] ),
BLANK (),
IF (
ISERROR ( VALUE ( PowerBI[SLA Alert] ) ),
BLANK (),
IF ( VALUE ( 'PowerBI'[SLA Alert] ) > 2 , 2 , 1 )
)
)
'2' for TRUE and '1' for FALSE
- aeterni7 years agoFrequent Visitor
Hi,
- I changed my local settings --> '.' as decimal separator
- I rebuilt my DB...otherwise I still had the "," as decimal separator
It works now.
Thank you.