cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## Creating a measure for Delta

I wrote this code to calculate the delta ( Diffrance )between the current year for the current month from the previos year for the same month BUT unfortunately it gives me sysntax error "," Can you please help to figure out where is the problem and how to solve it

Delta =
VAR CurrentMonth = MONTH(TODAY())
VAR CurrentYear = YEAR(TODAY())
VAR PreviousYear = CurrentYear - 1
RETURN
CALCULATE(
SUM(Sales[Amount]),
SAMEPERIODLASTYEAR('Date'[Date]),
YEAR('Date'[Date]) = PreviousYear,
MONTH('Date'[Date]) = CurrentMonth
) - CALCULATE(
SUM(Sales[Amount]),
YEAR('Date'[Date]) = CurrentYear,
MONTH('Date'[Date]) = CurrentMonth
)

Thanks.

1 ACCEPTED SOLUTION
Super User

Hi,

it's actually an error with the variable 'PreviousYear ' this is a reserved word - if you change it and the references to it in the measure it will work.

Super User

Hi,

it's actually an error with the variable 'PreviousYear ' this is a reserved word - if you change it and the references to it in the measure it will work.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.