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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
deepakqlikview_123
Specialist
Specialist

Requirement

Hi All,

I have data as per below

 

MonthData
Jan20
Feb10
Mar30
Apr50
May60
Jun70
Jul80
Aug90
Sept10
Oct20
Nov30
Dec

40

If user selects Feb then it will show Jan+Feb/2

If user selects Mar,Apr,May then it will show Feb+May/2

Can you please suggest.

Thanks

11 Replies
sunny_talwar

Either convert your Month field to be a dual field in the script using this:

LOAD Month(Date#(Month, 'MMM')) as Month

or try this expression:

=Sum({<Month={"$(=Pick(MinString(Month(Date#(Month, 'MMM'))-1), 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'))","$(=MaxString(Date#(Month, 'MMM')))"}>} Data) /2

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Selecting a single month will probably break the calculation. You can fix this by splitting the min/max month sum into two sums. In pseudo-expression code:

=(Sum({set spec for min selected month} Data) + Sum({set spec for max selected month} Data)) /2

Peter