Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SET ANALYSIS help

I want to compare two year sales, at the same month and same date

ex.

count number of sold items in november this year and compare with sold items sold at the same time last year.

As we have 11. november I want to count number of sold items in november this year = 11 days and

compare with the same amount of days last year i november.

I´ve tried with some help from another thread with something like this

({<year={$(vPreviousYear)},month={$(vMaxMonth)}, day={$(vLastMaxDate)}, itemgroup={75211}>}itemnr)

but this doent work


27 Replies
ali_hijazi
Partner - Master II
Partner - Master II

yes you can add alternate states and make comparative analysis in your expressions in the same chart

I can walk on water when it freezes
Not applicable
Author

Hi Mehmet

Using DAY gives me only the amount of items sold on TODAY() thsi year and last year.

What I want is -  what is sold in november this year and the same period last year equal to the first 12 days of november this year and 12 days i november last year - hope you understand

mehmet_caldak
Partner - Contributor III
Partner - Contributor III

Hi Soren,

just try this ,

Count ({<year={$(vPreviousYear)},month={$(vMaxMonth)},date={'<=$(vLastMaxDate)'}, itemgroup=75211}>}itemnr)

i tried this on your attached qvw, it works fine.

Not applicable
Author

Hi MEHMET

using the expression gives me an error in the expression like this

screenshot.116.jpg

the variable vlastMaxDate  somethings is wrong and the little red wave under the end parentes???????

rubenmarin

Hi, you only need:

count({<year, month, date={'$(vLastMaxDate)'}, itemgroup={75211}>}itemnr)

or

count({<year={$(vPreviousYear)},month={$(vMaxMonth)}, day={'$(=Day(vLastMaxDate))'}, itemgroup={75211}>}itemnr)

mehmet_caldak
Partner - Contributor III
Partner - Contributor III

of course, itemgroup value is not within brackets sorry..

the right one is this;

Count ({<year={$(vPreviousYear)},month={$(vMaxMonth)},date={'<=$(vLastMaxDate)'},itemgroup={75211}>}itemnr)

Not applicable
Author

Hi Ruben

the 2 expression only gives me the amount of the day and not between first day of month and lastMaxDate

which is what I want

jyothish8807
Master II
Master II

Hi Soren,

try like this:

count({<year={$(vPreviousYear)},month={">=$(=monthstart(date(max(month))) )<=$(=monthend(date(max(month))))"}, itemgroup={75211}>}itemnr)


Regards

KC

Best Regards,
KC
Not applicable
Author

It works but I only get the amount for VLastMaxDate and not for the whole month

from FirstDayOfMonth to VLastMaxDate

rubenmarin

Ops, sorry I readed this too fast, then it should be:

count({<year, month, date={'<=$(vLastMaxDate)'}, itemgroup={75211}>}itemnr)

or Mehmet expression also will work