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

Need some help with set_expressions !!

Hi

I'm quite new to QV so it might be a very simple question to answer for some of you...

I have a chart (graph) with a dimension lets say Category and Date (MMM-YYYY). What I'm trying to do is limit the Date-selectionbox to 1 selectable value that represents 1 month of 1 year. The graph then needs to show the selected month compared with 3 previous months. As expression lets say I just want to count the A-values so something like Sum(if(Value='A',1,0)).

I was trying to make this setup by using a set expression

     Sum( { 1 < Date={ " >=$(=AddMonths(Date,-3)) <$(=AddMonths(Date,1)) " } > } if(Value='A',1,0) )

The Graph works for the date, it show only the period that I need. But when I make a subselection of Categories, it keeps showing the full result, so all possible Categories.

I tried removing the leading 1 but that only shows the current selected month.

Any Ideas ? Maybe the setup that I have in mind needs another approach...

Thanks in advance !

P

1 Solution

Accepted Solutions
Not applicable
Author

I needed a date island...

View solution in original post

5 Replies
Not applicable
Author

In my real app I have two Categories Cat1 and Cat2... Don't know if that matters...

Not applicable
Author

Hi,

Not sure my understanding is correct, Try this below expression and check.

Sum({< Date *={ ">=$(=AddMonths(Date,-3)) <$(=AddMonths(Date,1)) " },Value *={'A'} > } 1)

- Sridhar

Not applicable
Author

Thanks for your answer, but unfortunately that didn't realy fullfil my needs...

I want to select 1 Index date, that has to be seen in the graph as a period of that month and 3 preceding months. I managed to do that with the set expression I mentioned before but it overrules the Category selection too. It should only overrule the Date selection to show a period of 4 months instead of the selected month.

In the graph I see full set of Categories, no matter the selection...

Not applicable
Author

Thought of something like ...

sum({$<[Cat1]=,

     [Cat2]=,

     [IndexDate]={">=$(var3MonthsAgo) <$(varNextMonth)"}>}

          If(Value='G',1,0))

But now I only see 1 month, the selected Month, not the timespan...

In this setup I would need the IndexDate calculation be done on the total dataset...

Not applicable
Author

I needed a date island...