Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

magdalena123
New Contributor III

How can i see only the last 4 weeks in chart_in Qlik Sense

Hi, I have a chart with the dimension: week number and some measures for each week. I want to see in chart, only the values for the last 4 weeks inclusive the week i select in filter. How can I do that? Thank you, Magdalena

1 Solution

Accepted Solutions
agigliotti
Honored Contributor II

Re: How can i see only the last 4 weeks in chart_in Qlik Sense

try with:

only( {< Week = {">$(=Max(Week) - 4)<=$(=Max(Week))"} >} [value1] )

6 Replies
agigliotti
Honored Contributor II

Re: How can i see only the last 4 weeks in chart_in Qlik Sense

use set analysis like below:

ex. sum( {< Week = {">$(=Max(Week) - 4)"} >} Sales )

magdalena123
New Contributor III

Re: How can i see only the last 4 weeks in chart_in Qlik Sense

Hi Andrea,

Thank you, but is not working.

My dimension is: week

My measure is: only({<[week]=>}[value1])

and when I make measure how you said: only( {< Week = {">(Week - 4)"} >} [value1] ) the chart is null.

Thank you,

Magdalena

agigliotti
Honored Contributor II

Re: How can i see only the last 4 weeks in chart_in Qlik Sense

only( {< Week = {">$(=Max(Week) - 4)"} >} [value1] )

magdalena123
New Contributor III

Re: How can i see only the last 4 weeks in chart_in Qlik Sense

Hi, You are right! I was writing wrong! It is ok, but only when I am selecting this week it appears the last 4 weeks, but when I select other weeks appear all the previos weeks, inclusiv the current week. How can I modiffics the measure to appear just 4 weeks, indifferent what week i select? Thank you, Magdalena

agigliotti
Honored Contributor II

Re: How can i see only the last 4 weeks in chart_in Qlik Sense

try with:

only( {< Week = {">$(=Max(Week) - 4)<=$(=Max(Week))"} >} [value1] )

magdalena123
New Contributor III

Re: How can i see only the last 4 weeks in chart_in Qlik Sense

Thank you Andrea!! Magdalena