Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rammarthi
Creator
Creator

How to use single month column with variables in Set Analysis

Hi,

I have a month column that is defined by Month(Report_dt) as RPT MONTH, which is in the format 'MMM', i.e., 'Jul','Aug', etc.,

I got the latest month into a variable with the help of Peek function as below:

RPT_MNTH:

LOAD

Max([RPT MONTH]) as MAX_RPT_MNTH

Resident RPT;

LET vMaxRPTMnth = Peek('MAX_RPT_MNTH',0,'RPT MONTH');

Now $(vMaxRPTMnth) has a value of 8 for latest month being 'Aug'

I wanted to use this variable in set analysis as below:

Sum({<[RPT MONTH] = {'$(vMaxRPTMnth)'}>}Sales)

But this equation is giving out 0.

I dont want another Month_Num variable/ field having 7,8 for Jul and Aug.

Help appreciated in advance.

Thank You

Ram Marthi

1 Reply
sunny_talwar

Change to this may be

RPT_MNTH:

LOAD MaxString([RPT MONTH]) as MAX_RPT_MNTH

Resident RPT;