Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SET Analysis expression help

I want to count how many items I got in stock this month compared to what was in stock at the same time last year.

So something like this:

( {<MONTH={$(vCurrentYearMonth)},MONTH = {$(vLastyearMonth)},ItemNumber={'76319','76329'} >} Items) plus the big problem

I want to count this month 27 days of oktober 2014 and 27 days oktober 2013

30 Replies
Not applicable
Author

Hi,

This year i mean 2014 oct upto 27 days Count of Items

Count({<month={'Oct'}, Day={'>=1 <=27'},Year={2014}>} Items)

Previous year i mean 2013 oct upto 27 days Count of Items

Count({<month={'Oct'}, Day={'>=1 <=27'},Year={2013}>} Items)

Not applicable
Author

Hi Rakesh

Ok yes that would work, - but the amount of days is variable.

If you use the variable vCurrentyearMonth on the 22. oktober or any other date the amount of days differ

Not applicable
Author

you can derive from the date as a day and as a month and as a year then u will get it right.

Not applicable
Author

I not sure

I want to compare 2014 to 2013

so if I use a variable to set current month I get 27 days

But If i use a variable to set month last year i get  31 days

I need to compare the same amount of days as days in current month this year

PrashantSangle

Hi,

Can you post your expression of variable

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
chematos
Specialist II
Specialist II

Set this variable:

vCurrentDays = Day(Today())

Current Year:

Count({<Month={$(vCurrentYearMonth)}, Day={<=$(vCurrentDays)},Year={$(=only(Year))},ItemNumber={'76319','76329'} >} Items)

Previous Year:

Count({<Month={$(vCurrentYearMonth)}, Day={<=$(vCurrentDays)},Year={$(=only(Year)-1)},ItemNumber={'76319','76329'} >} Items)

Not applicable
Author

Hi JOSE

I got a problem with the vCurrentDays variable

Count({<Month={$(vCurrentYearMonth)}, Day={'>=1 <=$(vCurrentDays) '},Year={$(=only(Year))},ItemNumber={'76319','76329'} >} Items)

First of all – Day is numeric, so I removed the quoatationsigns surrounding {'>=1 <=$(vCurrentDays) '} to {>=1 <=$(vCurrentDays) } so far so good.

But removing the quotations makes a fault later on after {>=1 <=$(vCurrentDays )},

Regards

Søren

Fra: JOSE MARIA TOS MIÑANA

Sendt: 27. oktober 2014 19:09

Til: Schou, Hans Henrik Søren (SSC009)

Emne: Re: - SET Analysis expression help

Qlik Community<http://community.qlik.com/>

SET Analysis expression help

reply from JOSE MARIA TOS MIÑANA<http://community.qlik.com/people/chema.tos?et=watches.email.thread> in App Development - View the full discussion<http://community.qlik.com/message/642473?et=watches.email.thread#642473>

alkesh_sharma
Creator III
Creator III

Hello,

Try these Expression:

Curent Year: SUM({<fYear={$(vMaxYear)},fMonth={$(vMaxMonth)},[%Master Date]={"<=$(='$(vToday)')"} >}[Net value])

Previous Year: SUM({<fYear={$(vPreviousYear)},fMonth={$(vMaxMonth)},[%Master Date]={"<=$(='$(vlastMaxDate)')"}>}[Net value_NETWR])

vMaxYear:=max(fYear)

vMaxMonth: =max(fMonth)

vToday: =date(Today(),'DD-MM-YYYY')

vLastMaxDate: =date((Today()-365),'DD-MM-YYYY')

Not applicable
Author

Hi alkesh

max(fyear) - what is fYear - I get an error using that