Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Measuring difference between Max week and previous in a KPI Widget

Hi All,

I want to use a KPI widget to show Numbers of Incidents for the Max week, Then add an up down arrow or conditional limit to show how this changed from the week previously.

I have tried to add a master calendar and from posts ive read I think that I need use use (Max(Date) and (Max(Date)-1) but haven't had any luck.

Examples of the kind of expressions ive tried are below

//Count(Incident)

//Count( {$<Year = {$(#varMaxDate)}>} Incident )

//=Count({<Month={$(=Max(Month)-1)}>} Incident )

//Count({<Month={$(=Max(Month)-1)}>} Incident)

//Count({<MonthName={"$(=Month(Max(Date)-1))"},Year={"$(=(Year))"}>}Incident)

//Count({$<MonthYear={$(=Only(MonthYear)-1)}>}Incident)

//Count({<Month = {$(MONTH =(MAX(Date))}>} Incident

//Count({<Year = {$(MAX(Year))},Month = {'$(=MONTH(MAX(Date)))'}>}Incident)

Any help would be much appreciated.

QVF attached

Thanks

Josh

14 Replies
Anonymous
Not applicable
Author

Attached

sunny_talwar

So essentially if Month is selected you will do a comparison to previous month and if Week is selected the comparison will be done to previous week? What about selection in Year or Date? If you select a date, will it then compare to yesterday also?

Anonymous
Not applicable
Author

At the moment Month and Week is my only requirement. However it would also be good if this could be extended to Year or Date (Exactly how you stated). Im hoping that if I see how this could be done with Week and Month I can work out how to do other time periods myself aswell.

Thanks

sunny_talwar

May be try this expression for Previous Period

If(GetSelectedCount(Week) > 0,

Count({<Start_Date = {"$(='>=' & Date(WeekStart(Max(Start_Date), -1)) & '<=' & Date(WeekEnd(Max(Start_Date), -1)))"}, Week, Month>}Incident),

If(GetSelectedCount(Month) > 0,

Count({<Start_Date = {"$(='>=' & Date(MonthStart(Max(Start_Date), -1)) & '<=' & Date(MonthEnd(Max(Start_Date), -1)))"}, Week, Month>}Incident)))

I am not sure if colors and directions or error are right or not. If the incidents went down from previous period the previous period number will be in green with down arrow?

Capture.PNG

I am sure you will be able to fix the colors.

HTH

Best,

Sunny

Anonymous
Not applicable
Author

Perfect! Many Thanks!