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

MTD Analysis KPI

HI All,

 I have One requirement,Please find the attached qvw

Requirement is

The data is up to August 2020.  So if the user opens the dashboard   by default in the KPI-Vol () the calculation will be  Last month-last lastmonth/lastlastmonth

example:if the data is august , while opening the dashboard ,it has to show (july data- june data)/ June data.

 and now comes tricky part. if the user selects  may 2020 month, the KPI-Vol ()  has to show as

(May data-April data)/(April data)..

Can anyone please help as it is very urgent . Please find the attached doc

 

 

Labels (1)
4 Replies
rushikale0106
Contributor III
Contributor III

Hi @qlikapple ,

I tried to solve your query in my system. I dint reach to the complete solution. But I created the expressions which will give you the current month when the dashboard is opened and after the selection, it will give you the last month and Last Last Month. I stored these expressions under variables .

Try to work around these expressions. I am trying it too.

vMonth:: =if(isnull(GetFieldSelections(Calender_Month_Name)), Month(Now()), GetFieldSelections(Calender_Month_Name))

vLast_Month:: =month(AddMonths(makedate(2020,(Num(Month(Date#(vMonth, 'MMMM'))))), -1))

vLast_Last_Month::  =month(AddMonths(makedate(2020,(Num(Month(Date#(vMonth, 'MMMM'))))), -2))

 

The first variable expression will give you the current month or the month selected from the filter.

Try it out. I will post again if I reach the final solution.

 

Regards,

Rushi

 

sunny_talwar

What happen when the user clears the selection? Does it go back to (july data- june data)/ June or does it stay on (May data-April data)/(April data)?

edwin
Master II
Master II

One way to accomplish this is build a bridge between a calendar table and your fact.  allow the user to select from calendar table.  the bridge will associate the date in the calendar table to three months of data in the Fact table: the current month, prior month, and two months back.  you can then control your expression by adding criteria in set analysis CurrentMonth={1}, or PriorMonth={1}, or TwoMonthsBack={1}.

you can further refine this is all you need is link to the whole month (in fact table add a monthstart and link that to the bridge).  good luck.

Calendar:
LOAD distinct
DECISION_DATE as Calendar_Date,
DEC_DATE,
DECI_DATE,
Date,
Year,
Month,
MonthYear,
MonthYears,
MonthYear123,
weeks,
Weekdays
Resident
TABLE_mod
;


drop fields DEC_DATE, DECI_DATE, Date, Year, Month, MonthYear, MonthYears, MonthYear123, weeks, Weekdays from TABLE_mod;


NoConcatenate
tmpBridge:
load
distinct Calendar_Date
Resident
Calendar
;

left join (tmpBridge)
load
Calendar_Date as DECISION_DATE
Resident
Calendar
;


NoConcatenate
Bridge:
load
DECISION_DATE,
Calendar_Date,
if(monthstart(DECISION_DATE) = monthstart(Calendar_Date),1) as CurrentMonth,
if(monthstart(DECISION_DATE) = addmonths(monthstart(Calendar_Date),-1),1) as PriorMonth,
if(monthstart(DECISION_DATE) = addmonths(monthstart(Calendar_Date),-2),1) as TwoMonthsBack
resident
tmpBridge
;


drop table tmpBridge;

NoConcatenate
NewBridge:
load
*
Resident
Bridge
where CurrentMonth = 1 or PriorMonth=1 or TwoMonthsBack=1;

drop table Bridge;

 

Brett_Bleess
Former Employee
Former Employee

See related post: https://community.qlik.com/t5/New-to-QlikView/MTD-Cal/m-p/1742496#M392761

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.