Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
nrj
Contributor
Contributor

Display 2 months previous data in current month

Hello everyone,

I have created a line graph that displays a comparison between different years and flow with respect to months.
I need a date function which shows 2 months' data in this month.

For example, display the value of May 2021 when we enter July 2021.

Here I need to satisfy few conditions:

Condition 1:display all previous years and months data.

Condition2: Display all months until 2 months before this month. I mean for 2021 it should only display From Jan 2021 until April 2021.

I have already used the limitation parameter in Line chart dimension to limit the values I see.

Like if the % is less than 15% it won't display it in the chart. But I want to make a dynamic change.

For example: if the value of May 2021 is less than 15% even after the end of July I want it to display in the chart.

nrj_0-1624355798022.png

Happy to receive any inputs. 

TIA

Regards,

Neeraja

Labels (1)
1 Reply
Pertjo
Partner - Contributor III
Partner - Contributor III

if you make a dimension for  YearPeriod in script editor , "Year" & "Period" as YearPeriod. 

You can use YearPeriod in variabels. such as vLastTwoMonths. Year(today("Year")) & month(num(Period,00)) -2 

or Year(today("Year")) & month(num(Period,00))  as vYTD

You can use it in the graph. In the Set Analysis write sum({<YearPeriod={$(vLastTwoMonths)}>}Amount)

or if you want to show all previous sum({<YearPeriod={">=$(vYTD)"}>}Amount)

 

It is always easier to work with YearPeriod.