Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I still figuring it out the difference between calculation in the Data vs Model tab, any insights are appreciated.
I am considering switching a calculation from Data to Model, so I copied and pasted the working formula from Data tab to the Model tab. I am getting the following error message 'Token RightParen expected'
Here is the working formula from the 'Data' tab:
apptime_adj = if([academid_year]="2016-2017",DATEADD(application_view[apptime],1095,DAY),if([academid_year]="2017-2018",DATEADD(application_view[apptime],730,DAY),if([academid_year]="2018-2019",DATEADD(application_view[apptime],365,DAY),[apptime])))
Solved! Go to Solution.
Hi @diogobraga2 ,
The if else statements are also written differently in the M Language. Try this:
= if [academid_year]="2016-2017" then Date.AddDays([apptime],1095) else if [academid_year]="2017-2018" then Date.AddDays([apptime],730) else if [academid_year]="2018-2019" then Date.AddDays([apptime],365) else [apptime]
Think it is at the end as you have three ifs and a Dateadd
Proud to be a Super User!
I triple checked, and I can't find a missing paren. I copied and pasted again from Data tab and I am certain it's exactly the same calculation...but on Model tab is giving me this error!
You are trying to copy your DAX expression in M Language.
DATEADD (DAX) is achieved by Date.AddDays in M Language. Refer the following for M Language:
Thanks! I fixed the syntax, but still getting the same error. What else do you suggest?
Hi @diogobraga2 ,
The if else statements are also written differently in the M Language. Try this:
= if [academid_year]="2016-2017" then Date.AddDays([apptime],1095) else if [academid_year]="2017-2018" then Date.AddDays([apptime],730) else if [academid_year]="2018-2019" then Date.AddDays([apptime],365) else [apptime]
This script worked. Thanks!
if [academid_year]="2016-2017" then Date.AddDays(application_view[apptime],1095) else if [academid_year]="2017-2018" then Date.AddDays(application_view[apptime],730) else if [academid_year]="2018-2019" then Date.AddDays(application_view[apptime],365) else [apptime]
Did you click on show error?
Proud to be a Super User!
There shouldn't be any difference. The section does not matter (Data vs Model) when creating calculated columns/measures.
The error indicates a missing bracket ')' in the formula. Could be a copy paste issue.
HI @diogobraga2 ,
I can't see it right off, but I would add a paren at the end. If that doesn't work, CTRL x all except the first test, then add back in piece by piece. You can copy the whole thing and paste it into a text pad or Word. Sometimes it helps to put in another medium.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Proud to be a Super User!
User | Count |
---|---|
140 | |
113 | |
104 | |
76 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |