Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am new to Power BI. I am trying to use the IF(<logical_test>,<value_if_true>[, <value_if_false>]) function.
This is my code:
But I get a syntax error for "timeFromQuoting", error is: "unexpected expression 'timeFromQuoting'".
However, when I replace the variable for the <value_if_true> parameter, with a hardcoded value, the error seems to disappear.
example if I do something like this:
Can anyone tell me why this would be happenning?
PS. I also think this related to my previous post: DAX-IF-no-longer-working
Solved! Go to Solution.
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
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
@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.
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.
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_Deckler
It does return if I remove the IF(). However, im going to need to be able to use the IF().
I uninstalled PowerBI and reinstalled, it still did not work.
I also downloaded the PowerBI sample "Sales & Returns Sample v201912Sales & Returns Sample v201912" and I got the error there too for the code:
Product Returns Top 3 = IF([ProductR Top N]<4,[Returns],0)
The syntax for '[Returns]' is incorrect. (DAX(IF([ProductR Top N]<4.[Returns],0))).
This makes me think there is a bigger issue.