Skip to main content
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
alopez
Contributor III
Contributor III

Override Set Analysis

Is there a way to override set analysis? If I have a table that only looks at 2023 data but now the consumer wants to see 2022 data. Is there a way to override and include my selection?

Here is the current set analysis:

=SUM({<SALES_STATUS={'Sale'},YEAR={'2023}>} SALES_PRICE)

Labels (2)
2 Solutions

Accepted Solutions
Tanish
Partner - Creator
Partner - Creator

Hi Alopez,

Rather than using Hard Code value in the Set Analysis like 

YEAR={'2023} , You can use dynamic value here like 

YEAR = {"$(=Year(Max(Date)))"}

You can keep a Filter of Year at the top. By default the table will show Current Year data but, If the user select any other year then it will show that specific year data. 

I hope this will help..........🙂

 

View solution in original post

BrunPierre
Partner - Master
Partner - Master

To filter data for the current year while excluding future years, use these modifiers

{$<Year={"$(=Year(Today()))"}, DateField = {"<=$(=Today())"}>}

View solution in original post

8 Replies
Tanish
Partner - Creator
Partner - Creator

Hi Alopez,

Rather than using Hard Code value in the Set Analysis like 

YEAR={'2023} , You can use dynamic value here like 

YEAR = {"$(=Year(Max(Date)))"}

You can keep a Filter of Year at the top. By default the table will show Current Year data but, If the user select any other year then it will show that specific year data. 

I hope this will help..........🙂

 

alopez
Contributor III
Contributor III
Author

Interesting, what happens if the max year is not the current year by chance?

BrunPierre
Partner - Master
Partner - Master

Hi, such a situation could occur when the date field contains future dates. That expression takes the maximum date value from the "Date" field and extracts the year component. You can create a flag field that indicates whether a date is in the future or not, and factor in or exclude future dates in your calculations.

alopez
Contributor III
Contributor III
Author

How would I use a flag for set analysis? I would be back at my original problem where I can't use the filters to update data.

Tanish
Partner - Creator
Partner - Creator

Then you can use Today() instead of the Max(Date) but the limitation is your date filters will not work.

 

BrunPierre
Partner - Master
Partner - Master

To filter data for the current year while excluding future years, use these modifiers

{$<Year={"$(=Year(Today()))"}, DateField = {"<=$(=Today())"}>}

barnabyd
Partner - Creator III
Partner - Creator III

G'day @alopez,

You don't override Set Analysis. It's the other way around. The user makes selections on the data using the filters on the page but Set Analysis can override the user selections.

What are your actual requirements? People have tried to answer your questions but I think that maybe your questions are not heading in the right direction!

Cheers, Barnaby.

Barnaby Dunn
BI Consultant
alopez
Contributor III
Contributor III
Author

The max feature is helpful for when you are working with dates.

Also using an operator for intersection was helpful as I found in another article. Set operators | Qlik Cloud Help

*=: This operator is used to define the corresponding field values based
on the intersection between what the user has selected and the values we
specify. That is, the resulting record set will be the values that "intersect" or
are present in both the user's selection and the values we explicitly define in
our element list.