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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
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

1 Solution

Accepted Solutions
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

View solution in original post

11 Replies
richard_chilvers
Specialist
Specialist

Hi

I'm not clear what your rules for the expression are.

For example, if the user selects Jul, Aug, Sep, what would the result be ?

avinashelite

Second part is not clear "If user selects Mar,Apr,May then it will show Feb+May/2" could you explain with an example i.e the output your excepting

antoniotiman
Master III
Master III

Hi,

try

Sum({<Month={'$(=Min(Month)-1)','$(=Max(Month))'}>} Data) /2

Regards

deepakqlikview_123
Specialist
Specialist
Author

Hi,

For multiple month selection We need max( month) + Min (month) -1 .

Otherwise show max (month)+ max( month)-1 if selection is only one month

Thanks,

avinashelite

I think @antoniotiman‌has already given the solution , did you tried ??

deepakqlikview_123
Specialist
Specialist
Author

Hi,

Thanks but this is not working

Thanks

sunny_talwar

Is month a text field or is it a dual field created using a date field?

Anil_Babu_Samineni

Is This is a Text field which you want to show the O/P

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
deepakqlikview_123
Specialist
Specialist
Author

yeah it is text field