Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last Month and Current Month Values Along with This month as a Dimension in Qlikview Straight Table

Hi Qliksupport Team,

I am trying to compare last month figures with current month figures and able to achieve it using the below formula...

Straight_Table_Last_Curr_Month.png

Month(SNAPSHOT_PERIOD) as Month,

     Date(MonthStart(SNAPSHOT_PERIOD), 'MMM-YYYY') as [Month Year],

     Year(SNAPSHOT_PERIOD) as Year

From a table...

&

set vMaxMonthYear = =Date(max([Month Year]), 'MMM-YYYY');

set vPriorMonthYear = =Date(addmonths(max([Month Year]), -1), 'MMM-YYYY');

let vMaxDate  = '=max(Date)';

let vMaxDay   = '=day(vMaxDate)';

let vMaxMonth  = '=month(vMaxDate)';

let vMaxYear  = '=Year(vMaxDate)';

let vPriorMonth  = '=month(addmonths(max(Date),-1))';

let vPriorYear  = '=vMaxYear-1';

let vPriorYearDate = '=date(addyears(max(Date),-1),' & chr(39) & 'DD MMM YYYY' & chr(39) & ')';

Created above variables...

Last month expression ::

='Last Month Fact_Resrv_1

$(vPriorMonthYear)'

Current Month Expression ::

Sum({<[Month Year]={'$(vMaxMonthYear)'},Year=,Month=,Date=>}CHNL_FACT_RESRV_1)

But however, when I use MonthYear as dimension in the same straight table, the result is as below...

Straight_Table_Last_Curr_With_Month.png

Is it possible to display same as first image even after adding MonthYear as dimension in straight table...?

If possible in any other chart(pivot table), please give the formulas for current & Previous month expressions...

1 Reply
Anil_Babu_Samineni

I assume you need operator like

Sum({1<[Month Year]={'$(vMaxMonthYear)'},Year=,Month=,Date=>}CHNL_FACT_RESRV_1)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful