Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am new to Power BI.
I am taking reports over from a previous employee in my company. I downloaded the .pbix file from app.powerbi.com for updating.
When I opened up a custom column to edit it I get errors in the IF() statement, though the report seems to be running and refreshing. The errors are "unexpected expression 'BLANK'" and "unexpected expression '_time'".
The code looks like this:
However, when I click enter on the code (without changing any of the code) the report breaks and I get a DAX syntax error:
Can anyone point me in the right direction as to why this is happenning?
Thank You
Solved! Go to Solution.
Try a second "," in your code
Try a second "," in your code
Hi @Anonymous.
I hope for you, that my code dosen't work. I don't like eating hats 😉
Yes your right, BLANK isn't thr problem. Its the number. I expect that Power BI try to check "_time < 0.BLANK()" but can't handle the number 0.BLANK (or" 4.Returns" in the other case). Probably he has german numbers in Porwer BI. We use , to seperate between integer and decimal.
Best regard
Bruening
@Anonymous @Anonymous
It seems to be working. This is crazy:
When I change the returniftrue parameter to an integer it works, So I did suspect PowerBI couldn't handle a variable for that parameter. But as I said, the sample code also did not work, which through me off.
How do I go about changing my PowerBI not to use german numbers???
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)
Hey @TBardien ,
the sample code is not working with the same problem. "4.Return" is not a correct number for Power B.
I am not sure if its enoght to change the language in File --> Options & sttings --> options --> Regional settings
but ou can try a shot there 🙂
Best Regards
Bruening
@Anonymous
Changing the language settings does not help.
Did you try it with an new report or with you old report. The model language can't be changed. If it's not working i haven't an idea what to do 😞
Time in Quoting (hours) =
VAR _time =
DATEDIFF (
RequestWorkflowHistory[Quoting],
RequestWorkflowHistory[Quoted],
MINUTE
) / 60
RETURN
IF ( _time >= 0, _time )
Do the above.
Best
D
@Anonymous
nope, still not working:
The DAX is correct. It's something wrong with your file. Please update PBI Desktop to the latest version and refresh the model.
By the way, is [Time in Quoting (hours] a measure or a calc column? If it's a measure, then this DAX might or might not be correct. I can't say because you're not following Best Practices. Are '...'[Quoted] and '...'[Quoting] measures?
Best
D
@Anonymous
calc column i think, this is the properties of it.
@Anonymous
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))).
@TBardien Looks like you are using "." instead of a comma.
Corrected
return IF(_time < 0, BLANK(), _time)
If you find this answer useful, please mark this as an accepted solution.
@nandukrishnavs I am using a "," You can see when you view the code, However, when the error pops up, it shows a "." This is the code that breaks:
@TBardien - I have formatted the DAX measure.
Try to copy-paste below code.
Time in Quoting (hours) =
VAR _time =
DATEDIFF (
RequestWorkflowHistory[Quoting],
RequestWorkflowHistory[Quoted],
MINUTE
) / 60
RETURN
IF ( _time < 0, BLANK (), _time )
Copied the code, still the same error:
The syntax for 'BLANK' is incorrect. (DAX(VAR _time = DATEDIFF ( RequestWorkflowHistory[Quoting], RequestWorkflowHistory[Quoted], MINUTE ) / 60RETURN IF ( _time < 0. BLANK (), _time ))).
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
26 | |
22 | |
12 | |
8 |
User | Count |
---|---|
73 | |
51 | |
45 | |
16 | |
12 |