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: 
james
Creator III
Creator III

Max and Min Date Alternate States

I am struggling with obtaining the Min and Max Dates for
expression labels. I have 2 alternate states created and I want the label to
dynamically show the min and max dates for the user section. S that If 1 state
was Oct Through May, it would show Oct … May.

I normally use the following when it’s not an alternate
state

Month(min(DATE_SORT))&' ...
'&
Month(max(DATE_SORT))

Any ideas?

1 Solution

Accepted Solutions
krishna_2644
Specialist III
Specialist III

Hi james,

Set Expression will be a bit different while using Alternate States.

in your case, the expression would likely be

month(min({StateA <[Date]=[StateB]::Date>}  if(Date >= '5/1/2005' and Date <= '10/31/2005', Date) ))   & '...' &

month(max({StateB <[Date]=[StateA]::Date>} if(Date >= '5/1/2005' and Date <= '10/31/2005', Date)))

--> you can remove the IF() conditions and put your own field

Alt States.PNG

View solution in original post

9 Replies
sunny_talwar

May be like this:

Month(min({NameofAlternateState}DATE_SORT))&' ...
'&
Month(max({NameofAlternateState}DATE_SORT))

james
Creator III
Creator III
Author

Yes, that doesn’t work. I have tried that

sunny_talwar

What exactly are your trying to do? May be I don't completely understand your requirement.

james
Creator III
Creator III
Author

I have 2 alternate states With Period as a section.

I want the Label to Show the Min Period and the max period, so that I don’t see 7 period names in the label. I’d rather see Oct…Mar, which I can always do when I’m not dealing with Alternate States

krishna_2644
Specialist III
Specialist III

Hi james,

Set Expression will be a bit different while using Alternate States.

in your case, the expression would likely be

month(min({StateA <[Date]=[StateB]::Date>}  if(Date >= '5/1/2005' and Date <= '10/31/2005', Date) ))   & '...' &

month(max({StateB <[Date]=[StateA]::Date>} if(Date >= '5/1/2005' and Date <= '10/31/2005', Date)))

--> you can remove the IF() conditions and put your own field

Alt States.PNG

james
Creator III
Creator III
Author

Thanks that works, I just now need to make the if(Date >= a variable off of the alternate state

james
Creator III
Creator III
Author

This works fine… I guess the if section is just a fake statement to help it render

=Only( Year) &chr(10)& month(min({State1 <[PER]=[State1]::PER>} if(DATE_SORT >= vMaxDate, DATE_SORT) )) &'...'& month(max({State1 <[PER]=[State1]::PER>} if(DATE_SORT >= vMaxDate, DATE_SORT) )) &chr(10)& Only( PlanVersion)

krishna_2644
Specialist III
Specialist III

Awesome..Hope i helped you. happy Qliking.

Thanks

krishna

krishna_2644
Specialist III
Specialist III

Please mark it answered.

Thanks