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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Milaf
Contributor III
Contributor III

Parametric data extraction with month-based column structure

Hello,

There is an issue that I have to solve very quickly and I wanted to consult your knowledge. I have a table where the data of each month is kept in a separate column and in the table I want to create, I should show the actual values such as this month, last month, 3 months ago.

I created the following parameter to get the month I want from the columns:
vActual: ='Act_'& [Month(Num)]
(gives October data: like Act_10.)

For 3 Months before
v3MonthsAgo: =Date(AddMonths(Max(YearMonth),-2),'YYYYYMM')
sum({<“$(v3MonthsAgo)”= $(v3MonthsAgo)>} “$(vActual)")

However, in all cases, it shows the last month's realization. How can I fix this?

 

Labels (3)
10 Replies
Kushal_Chawda

@Milaf  as you are using YearMonth itself as dimension, set analysis won't work. Set analysis works once per chart. You need if condition here

v3MonthsAgo: =Date(addmonths(date#(Max(YearMonth),'YYYYMM'),-2),'YYYYMM')

sum(aggr(if(YearMonth>=$(v3MonthsAgo), [$(vActual)]),YearMonth))

or

sum(if(YearMonth>=$(v3MonthsAgo), [$(vActual)]))