9 Replies Latest reply: May 27, 2015 10:10 AM by Krishna Nagulapally

# 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?

• ###### Re: Max and Min Date Alternate States

May be like this:

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

• ###### Re: Max and Min Date Alternate States

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

• ###### Re: Max and Min Date Alternate States

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

• ###### Re: Max and Min Date Alternate States

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

• ###### Re: Max and Min Date Alternate States

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

• ###### Re: Max and Min Date Alternate States

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

• ###### Re: Max and Min Date Alternate States

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)

• ###### Re: Max and Min Date Alternate States

Awesome..Hope i helped you. happy Qliking.

Thanks

krishna