Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

madnanansari
New Contributor III

Last Year Same Day Sales

I am trying to create a table with the below information:

Date, Sales, Sales (Last Year Same Day)

01/12/2016, 50, 21

02/12/2016, 23, 21

..

..

for Sales (Last Year Same Day) I am trying the below formula:

Sum(

{<

[Date]={$=(Max([Date])-364)}

>}

Sales

)

This is just bringing '0'. I tried lot of options but it don't work at all.

Any help?

Tags (1)
19 Replies
shraddha_g
Honored Contributor III

Re: Last Year Same Day Sales

Try

Sum(

{<

[Date]={"$(=date(addyears(Max([Date]),-1)))" }

>}

Sales

)

Re: Last Year Same Day Sales

SUM({<YourDateField = {'$(=Date(AddYears(Max(YourDateField),-1))'}>}Sales)

madnanansari
New Contributor III

Re: Last Year Same Day Sales

this works fine when there is no master calendar. Once I use one; it shows zero values then.

Master calendar has other columns as well like Quarter, Year, Month etc along with Date.

kalyanivintha1
Contributor II

Re: Last Year Same Day Sales

Hello Mohammad,

you don't want to use.. -364 like this...

we have a...calendar functions like...addyears and addmonths to play on date fields.

Try your expression like this...

sum({<Your Date filed={$(=AddYears(Today(),-1))}>}[Final Price])

or

sum({<Your Date Field={$(=AddYears(Max(YourDateField),-1))}>}[Final Price])

madnanansari
New Contributor III

Re: Last Year Same Day Sales

I tried as you suggested and it shows zero.

shraddha_g
Honored Contributor III

Re: Last Year Same Day Sales

If possible share sample app

madnanansari
New Contributor III

Re: Last Year Same Day Sales

I have designed a sample App. How to share it here?

shraddha_g
Honored Contributor III

Re: Last Year Same Day Sales

click on Reply - > Use Advanced Editor on top right corner  - > attach at bottom right corner

madnanansari
New Contributor III

Re: Last Year Same Day Sales

Pls. find the sample app. The only sheet shows a filter of Month and the table shows day wise sales for each day of the month.