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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select moore months in Set Analys

Hello,

is it possible to get this?

If I select a year and lets say febr and mars  and get the result for the same months in a set analysis like this?

this is what I have stored in a variable for Last Year Month Today and of course I only get the last mont in my selection.

Can I change it in some way to get the two selected months?

PeriodID = {$(=Max(PeriodID) - 12)},

Year = {$(=Max(Year)-1)},

Quarter = ,

Period = ,

Month =

Håkan

18 Replies
Not applicable
Author

My intention is to show the values for febr and mars 2016 in MTD (works fine) and

the values for febr and mars 2015 in LYMTD.

The calculation for MTD is   Sum( $(vNettoFörs)) and for the same period last year

Sum({$<$(vSetLYMTD)>} $(vNettoFörs)) where my values in vSetLYMTD is

PeriodID = {$(=Max(PeriodID) - 12)},

Year = {$(=Max(Year)-1)},

Quarter = ,

Period = ,

Month =

But in this case I get the value for mars 2015 not febr and mars 2015.

Håkan

PrashantSangle

Hi,

Alter your variable add >=

vSetLYMTD is

PeriodID = {">=$(=Max(PeriodID) - 12)"},

Year = {$(=Max(Year)-1)},

Quarter = ,

Period = ,

Month =

Regards,

Prashant

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 🙂
adamdavi3s
Master
Master

as I said above.....

Also you don't NEED that periodID set! Gah! Come on!! its already a given based on the year (Again as I said above)

vSetLYMTD is

PeriodID = ,

Year = {$(=Max(Year)-1)},

Quarter = ,

Period =

edited to remove month thanks mgrabara_bpx

Not applicable
Author

In this case do I get the whole 2015

Not applicable
Author

Hi,

Do you people even read anothers posts or just gathering points? This community is getting worse and worse.

Håkan - please check my expression, that should solve your problem

Adam Davies - this won't work because you disregarded "Month" so Håkan selection over months will be ommitted

BR,

Milosz

adamdavi3s
Master
Master

Hi Milosz,

Your answer actually has exactly the same result at the original answer I posted

sum({<PeriodID={">=$(=Max(PeriodID) - 12)"}>}yourfield)


Its just a slightly different way of doing it.


There are many different ways of doing this, however you are correct in that month should not have been included in my answer, thank you for spotting that



Not applicable
Author

Hi,

Adam I agree with your solution but only when PeriodID is unique for year and month and going from "1 to n". I assumed that in Håkan's data it can be for example from 1 to 12 for every year repeating. But we don't know that actually. I think he could try both methods and check if values are correct.

BR,

Milosz

adamdavi3s
Master
Master

Totally agree Milosz, without knowing the exact setup it is possible to have many different answers which leads to a lot of ambiguity.

p.s. I also agree with your comment re the community, I remember a time when you could help someone out without 43 other people jumping in to give the same answer. Its the points system IMHO it breeds this bad behaviour

Not applicable
Author

Hello Miloz,

yes, you are correct, this is the right answer, I misspelled when I tried it

Now it works fine.