Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
madnanansari
Creator
Creator

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?

19 Replies
shraddha_g
Partner - Master III
Partner - Master III

Try

Sum(

{<

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

>}

Sales

)

MK_QSL
MVP
MVP

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

madnanansari
Creator
Creator
Author

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.

Anonymous
Not applicable

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
Creator
Creator
Author

I tried as you suggested and it shows zero.

shraddha_g
Partner - Master III
Partner - Master III

If possible share sample app

madnanansari
Creator
Creator
Author

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

shraddha_g
Partner - Master III
Partner - Master III

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

madnanansari
Creator
Creator
Author

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.