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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date Issues

Hi,

  Here is my problem, i have a sales table that started last year, and i want to compare sales from this year with the year before in two ways, the first like going exactly 365 days back and the other pointing to a specific date in the past, The table goes like this:

   Date

   Sales_Amount

   Store_Id

   Equivalent_date

The last field would be the equivalent day to compare (to solve issues arround feb 29 or special day sales).

Im trying something like:

=sum({$<Equivalent_date={"=$(Date)"}, Date=>} Sales_Amount)

It just dont work

Thx in advance.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could try this:

=sum({$<Equivalent_date={'$(=only(Date))'}, Date=>} Sales_Amount)

Note, if you want to use Date or Equivalent_date as dimension then set analysis won't work. You'll have to create another table:

Sales:

Load Date, Store_id, Amount, Equivalent_date,

autonumber(Store_id&Equivalent_date) as Key

Sales_LY:

Load autonumber(Store_id&Date) as Key,

Amount as Amount_LY

resident Sales;

Now you can use Date and Store_id as dimensions and as expressions sum(Amount) and sum(Amount_LY)


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Not applicable
Author

Hi fernando,

You want to show max year and previous year comparision am i right then conver the date as a year. Can you send that app i will do your need.

Regards,

Nirmal

khadeer
Specialist
Specialist

Hi

Actual Year

sum({<Year={$(=max(Year))}>} Sales_Amount)

Last Year

sum({<Year={$(=max(Year -1))}>} Sales_Amount)

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could try this:

=sum({$<Equivalent_date={'$(=only(Date))'}, Date=>} Sales_Amount)

Note, if you want to use Date or Equivalent_date as dimension then set analysis won't work. You'll have to create another table:

Sales:

Load Date, Store_id, Amount, Equivalent_date,

autonumber(Store_id&Equivalent_date) as Key

Sales_LY:

Load autonumber(Store_id&Date) as Key,

Amount as Amount_LY

resident Sales;

Now you can use Date and Store_id as dimensions and as expressions sum(Amount) and sum(Amount_LY)


talk is cheap, supply exceeds demand
makkemik
Partner - Contributor III
Partner - Contributor III

So how can I find rolling -365 days sales with max selection of year and/or month ?