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: 
Anonymous
Not applicable

set analysis

Hii All,

I am creating a line chart,using date column for dimension and sum of revenue for expression.

whenever i should select a date i should see data for the last 30 days

I am using this set analysis sum({<Month=,Date={'>=$(=thirty_day)) & <=$(=select_day)'}>}Revenue)

where select_day and thirty_day are variables and gives the selected day and 30th day from the selected date respectively

this is not working for me, I am attaching a image of what I am looking for

Thanks in Advance !

1 Solution

Accepted Solutions
campbellr
Creator
Creator

Hi Amrit

You might need to add 1 into the set analysis to select from the entire dataset. The issue with Aruna's response is it works from the most recent date in the data as a point of reference. When nothing is placed in the start of the set analysis Qlik works on the current selections, this can be represented with a $ where I have added the 1. Putting in the Month= will make it ignore a selection of month but your selection is in the date field, and you can't ignore that in the same way.

So:

sum({1<Date={'>=$(=thirty_day)) & <=$(=select_day)'}>}Revenue)

View solution in original post

5 Replies
shiveshsingh
Master
Master

May be this?

Hope your format for Date and variables is same.

sum({<Month=,Date={">=$(=thirty_day)<=$(=select_day)"}>}Revenue)

Anonymous
Not applicable
Author

HI,

Try below

=sum({<Date={">=$(=Date(Max(Date)-29))  <=$(=Max(Date(Date)))"}>}Sales)

Capture.PNG

vishsaggi
Champion III
Champion III

I assume your Date field is in your actual Date format. It will not work to compare a day with date. Follow Aruna's expression else share your variable expression you have.

campbellr
Creator
Creator

Hi Amrit

You might need to add 1 into the set analysis to select from the entire dataset. The issue with Aruna's response is it works from the most recent date in the data as a point of reference. When nothing is placed in the start of the set analysis Qlik works on the current selections, this can be represented with a $ where I have added the 1. Putting in the Month= will make it ignore a selection of month but your selection is in the date field, and you can't ignore that in the same way.

So:

sum({1<Date={'>=$(=thirty_day)) & <=$(=select_day)'}>}Revenue)

Anonymous
Not applicable
Author

Thanks !