# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

## Previous year expression in not working in Sense

Hi All,

This expression is not working in QVSense

(Sum({\$<FinancialYear=,FiscalYear={\$(=max(FiscalYear)-1)}, Quarter=

,[Posting Date]={">=\$(=YearStart(max({\$<FiscalYear={\$(=max(FiscalYear))}>}[Posting Date]),-1,4))<=\$(=addmonths(max({\$<FiscalYear={\$(=max(FiscalYear))}>}[Posting Date]),-12))"}

>} [ Sales ])

1 Solution

Accepted Solutions
MVP

## Re: Previous year expression in not working in Sense

What is Posting Date's format in Qlik Sense? Is it different then what is set during the reload in the environmental variables? If it is, then you might need to use Date() function in your set modifier

Sum({\$<FinancialYear=,FiscalYear={\$(=max(FiscalYear)-1)}, Quarter=

,[Posting Date]={">=\$(=Date(YearStart(Max({\$<FiscalYear={\$(=max(FiscalYear))}>}[Posting Date]),-1,4), 'DateFieldFormatHere'))<=\$(=Date(AddMonths(Max({\$<FiscalYear={\$(=max(FiscalYear))}>}[Posting Date]),-12), 'DateFieldFormatHere'))"}>} [ Sales ])

Also, check this link out:

Dates in Set Analysis

4 Replies
Honored Contributor III

## Re: Previous year expression in not working in Sense

Try

Sum({\$<[Posting Date] ={">=\$(=Date(YearStart(max([Posting Date]),-1,4)))<=\$(=date(addmonths(max([Posting Date]),-12)))"}, FinancialYear=,FiscalYear=,Month=,Quarter=>} [ Sales ])

New Contributor III

## Re: Previous year expression in not working in Sense

I tried but it is not working

Honored Contributor III

## Re: Previous year expression in not working in Sense

share a sample app if possible

MVP

## Re: Previous year expression in not working in Sense

What is Posting Date's format in Qlik Sense? Is it different then what is set during the reload in the environmental variables? If it is, then you might need to use Date() function in your set modifier

Sum({\$<FinancialYear=,FiscalYear={\$(=max(FiscalYear)-1)}, Quarter=

,[Posting Date]={">=\$(=Date(YearStart(Max({\$<FiscalYear={\$(=max(FiscalYear))}>}[Posting Date]),-1,4), 'DateFieldFormatHere'))<=\$(=Date(AddMonths(Max({\$<FiscalYear={\$(=max(FiscalYear))}>}[Posting Date]),-12), 'DateFieldFormatHere'))"}>} [ Sales ])

Also, check this link out:

Dates in Set Analysis