Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Fq
Partner - Contributor II
Partner - Contributor II

FIlter dimension values in a line chart

Hi,

I have the following problem.

I need to display a measure only for current year and last year, (22 and 21 in this case) and aggregate it by week. But I need to only show Current and Last Year.

With set analysis in the expression I was able to filter the data for only last 2 years, but still the chart is being displayed for all the years (previos 2021 no data). 

Fq_0-1674830594743.png

 

I have YYYY-WWW field which is the combination of year and Week, that it exists in the master calendar. I only want 2021 and 2022 values in the dimension so it doesn't exists the space in the chart for previos period, how can I solve that?

 

I tried using set analysis in the dimension but didn't work. 

 

1 Reply
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

The "secret" is to use Set Analysis in the Measure, not in the Dimension, and disable "Show Zeroes" in the Chart properties. This, however,  may lead to losing some of the weeks in the desired range if the measure renders zero in those weeks.

Alternatively, you could use a Calculated Dimension with the use of the AGGR() function:

AGGR( ONLY({<Year= ... >}  YearWeek), YearWeek)

In this case, disable NULL values for the Dimension to avoid showing previous years.

To learn more about advanced analytics, come to my online session on Set Analysis and AGGR at the virtual Masters Summit for Qlik on March 1st! You will learn many useful development techniques!

Cheers,