Forum Discussion
DAX IF() not working as expected.
- Anonymous6 years ago
Yes i think it is the same solution from your other post.
In the first case you got the same problem that Power BI thinks "0,timeFromQuoting" is one expression. In the second example you have timeFromPending<0,0 (international timeFromPending<0.0) and and only the true case timeFromPending (because the real true case 0 is in the inequality statement).
So again try the second "," should work
var timeFromPending = DATEDIFF(RequestWorkflowHistory[Quote Pending Max], RequestWorkflowHistory[Quoted], MINUTE) / 60var timeFromQuoting = DATEDIFF(RequestWorkflowHistory[Quoting], RequestWorkflowHistory[Quoted], MINUTE) / 60var QuotingTime = IF(timeFromPending<0,, timeFromQuoting, timeFromPending)return QuotingTimeBest regards
Bruening
- 6 years agoWhen I wrote my first book, I had some of these issues when formulas were checked with international settings and I found that putting spaces after my commas in my formulas tended to fix the issues. Basically what was going on from what I could tell is that DAX ends up thinking it is a decimal point because everything is numeric. but when you put a space in, DAX wises up and realizes it is not just all one decimal number.
- 6 years ago
Spaces BEFORE the comma seems to do the trick.
So instead of:
IF(_time < 0, BLANK(), _time)
you would make it:
IF(_time < 0 , BLANK(), _time)
Yes i think it is the same solution from your other post.
In the first case you got the same problem that Power BI thinks "0,timeFromQuoting" is one expression. In the second example you have timeFromPending<0,0 (international timeFromPending<0.0) and and only the true case timeFromPending (because the real true case 0 is in the inequality statement).
So again try the second "," should work
Best regards
Bruening
- TBardien6 years ago
Helper I
Anonymous
Yes, It is the same issue. Thank You.
Greg_DecklerWhen I add a second comma in the IF() after the logical_test, it seems to work.
Doing this: var QuotingTime = IF(timeFromPending<0,, timeFromQuoting, timeFromPending)
Anonymousseems to think its some numer/regional setting, but we can't seem to figure out what exactly it is.
- Greg_Deckler6 years ago
Community Champion
When I wrote my first book, I had some of these issues when formulas were checked with international settings and I found that putting spaces after my commas in my formulas tended to fix the issues. Basically what was going on from what I could tell is that DAX ends up thinking it is a decimal point because everything is numeric. but when you put a space in, DAX wises up and realizes it is not just all one decimal number.- TBardien6 years ago
Helper I
Spaces BEFORE the comma seems to do the trick.
So instead of:
IF(_time < 0, BLANK(), _time)
you would make it:
IF(_time < 0 , BLANK(), _time)
- Greg_Deckler6 years ago
Community Champion
Regional settings are found in two places. File | Options and settings | Options and then there are two places for Regional Settings, default and CURRENT FILE.