Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Month selection in column headers

Hi,

We want column headers in columns as following

if in month listbox continuous months are selected, i.e Jan, Feb , Mar  then  'Jan to Mar'

otherwise if Jan and March selection then concatenation of Months as 'Jan,Mar' in column headers.

Please me if some one has done same thing in past.

Regards,

Navdeep

1 Solution

Accepted Solutions
martinpohl
Partner - Master
Partner - Master

Take this:

=if(num(max(Month))-num(min(Month))+1=GetSelectedCount(Month),maxstring({<Num={$(=min(Num))}>}Month)&'-'&maxstring({<Num={$(=max(Num))}>}Month)

,concat(Month,','))

Add a field Num in your calendar where the monthnumber is in.

Unfortunaly the concated values of months are sorted by string, not by number,

Regards

View solution in original post

11 Replies
jsingh71
Partner - Specialist
Partner - Specialist

=GetFieldSelections(YourFieldName)

This will give you selected field name.

_rohitgharat
Creator
Creator

hiiii Navdeep,

                use getfieldselections(FieldName) function to get your desired result.

Regards,

Rohit

Not applicable
Author

I don't want all field names in case of continuous selection, only min and max otherwise field names.

MayilVahanan

Hi

If the user select May, Jul and Dec, In that case, how do you need to display in the column header?

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
tamilarasu
Champion
Champion

Try like below,

=If(GetSelectedCount(Month)=2, Concat(Getfieldselections(Month),','),

Subfield(GetFieldSelections(Month,',',12),',',1) &' To ' & Subfield(GetFieldSelections(Month,',',12),',',GetSelectedCount(Month)))


Change Month to your field name.


Or simply try this.


=If(GetSelectedCount(Month)>0, Concat(Getfieldselections(Month,',',12),','))

Not applicable
Author

all three of them May,Jul, Dec. You can just relate it to how Qlikview shows data when user make selection in Month selection.

Not applicable
Author

Hi Nagraj,

That 2 column thing was just an example, actually we can have any number of discontinuous selection, in that case you solution will give x to y. Correlate it with Qlikview data selection.

Not applicable
Author

It's not giving correct O/P.

tamilarasu
Champion
Champion

Can you post the incorrect output or explain what is wrong!!