Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
vincenzorago
New Member

Syntax error

Hi, why this VAR - RETURN function is giving me error? It is correct until the first part "VAR_AVG_TL". The second formula is identical except for the standard deviation instead of the average. Thanks in advance
 
This the formula:
 
VAR _Avg_TL =
CALCULATE(
    AVERAGE('Merge RPE duration'[TL]),
    DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY)
)
VAR _SD_TL =
CALCULATE(
    STDEV.P('Merge RPE duration'[TL]),
    DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY)

VAR _Monotony = DIVIDE(_Avg_TL, _SD_TL)

RETURN
    _Monotony
 
 
 
This is the error:
The syntax for 'VAR' is incorrect. (DAX(CALCULATE( AVERAGE('Merge RPE duration'[TL]), DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY))VAR _SD_TL = CALCULATE( STDEV.P('Merge RPE duration'[TL]), DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY)VAR _Monotony = DIVIDE(_Avg_TL, _SD_TL)RETURN _Monotony)).
1 ACCEPTED SOLUTION
Idrissshatila
Super User
Super User

Hello,

 

Try this one

 

VAR _Avg_TL =
CALCULATE(
    AVERAGE('Merge RPE duration'[TL]),
    DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY)
)
VAR _SD_TL =
CALCULATE(
    STDEV.P('Merge RPE duration'[TL]),
    DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY))

VAR _Monotony = DIVIDE(_Avg_TL, _SD_TL)

RETURN
    _Monotony
 

If I answered your question, please mark my post as solution, Appreciate your Kudos👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi,

 

Here is the edited version of measure. 

 

Best Regards,

Ezgi Naz Aslankara

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

measure = VAR _Avg_TL=
CALCULATE(
AVERAGE('Merge RPE duration'[TL]),
DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY)
)
VAR _SD_TL =
CALCULATE(
STDEV.P('Merge RPE duration'[TL]),
DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY))

VAR _Monotony = DIVIDE(_Avg_TL , _SD_TL)

RETURN
_Monotony
Idrissshatila
Super User
Super User

Hello,

 

Try this one

 

VAR _Avg_TL =
CALCULATE(
    AVERAGE('Merge RPE duration'[TL]),
    DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY)
)
VAR _SD_TL =
CALCULATE(
    STDEV.P('Merge RPE duration'[TL]),
    DATESINPERIOD('Merge RPE duration'[Date],LASTDATE('Merge RPE duration'[Date]),-7,DAY))

VAR _Monotony = DIVIDE(_Avg_TL, _SD_TL)

RETURN
    _Monotony
 

If I answered your question, please mark my post as solution, Appreciate your Kudos👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




lukiz84
Memorable Member
Memorable Member

missing ")" before "VAR _Monotony..."

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.