# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
Contributor III

## Getting max field (On calculated field) while opening the Document

Hi Experts,

Gm!

I have a calculated Month field and below is my expression..

=if((right(Date(if(YDAY=Aggr( NODISTINCT Max({<CALENDAR_YEAR_MONTH_CD = ,YDAY = ,Month_Name = , Year_Name =>}YDAY),Month_Name, Year_Name),YDAY),'MM/DD/YYYY'),4) &

lEFT(Date(if(YDAY=Aggr( NODISTINCT Max({<CALENDAR_YEAR_MONTH_CD = ,YDAY = ,Month_Name = , Year_Name =>}YDAY),Month_Name, Year_Name),YDAY),'MM/DD/YYYY'),2)) = CALENDAR_YEAR_MONTH_CD,

MonthName((if(YDAY=Aggr( NODISTINCT Max({<CALENDAR_YEAR_MONTH_CD = ,YDAY = ,Month_Name = , Year_Name =>}YDAY),Month_Name, Year_Name),YDAY))))

I see all the Months (No Issues)... Now my requirement is ... While opening the document , i need the max Month in this list box to be selected by default.. How can I?

Tags (4)
1 Solution

Accepted Solutions
Highlighted
MVP

## Re: Getting max field (On calculated field) while opening the Document

I have added static values, but you can change them as per need... but the main idea here is that you need trigger on 4 fields to get this done

1) CALENDAR_YEAR_MONTH_CD

2) Month_Name

3) Year_Name

4) YDAY

33 Replies
Highlighted
Valued Contributor

## Re: Getting max field (On calculated field) while opening the Document

Hi,

This is a wild guess

=AGGR(ONLY({<CALENDAR_YEAR_MONTH_CD={"=\$(=Max({1} CALENDAR_YEAR_MONTH_CD))"}>} CALENDAR_YEAR_MONTH_CD), CALENDAR_YEAR_MONTH_CD)

Cheers,

Luis

Highlighted
Contributor III

## Re: Getting max field (On calculated field) while opening the Document

No... When i apply the expression that i had mentioned .. i see Month's column in a List box... In that List box i want the max month to be selected by Default while opening the document..

Highlighted
Valued Contributor

## Re: Getting max field (On calculated field) while opening the Document

Hi,

Sorry, I misread your issue. I've never done it but found the following for Qlikview

Default Selection in Qlikview

I hope this helps,

Cheers,

Luis

Highlighted

## Re: Getting max field (On calculated field) while opening the Document

What is your Month Field here?

Can you test this for a while =Max(MonthField)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
Contributor III

## Re: Getting max field (On calculated field) while opening the Document

Hi Anil - I have created the below expression(For Month field) to achieve the Biz logic ... Now i see the Months after the below Expression is applied... Requirement is Now i need the max Month to be selected from this expreesion while opening the document..

=if((right(Date(if(YDAY=Aggr( NODISTINCT Max({<CALENDAR_YEAR_MONTH_CD = ,YDAY = ,Month_Name = , Year_Name =>}YDAY),Month_Name, Year_Name),YDAY),'MM/DD/YYYY'),4) &

lEFT(Date(if(YDAY=Aggr( NODISTINCT Max({<CALENDAR_YEAR_MONTH_CD = ,YDAY = ,Month_Name = , Year_Name =>}YDAY),Month_Name, Year_Name),YDAY),'MM/DD/YYYY'),2)) = CALENDAR_YEAR_MONTH_CD,

MonthName((if(YDAY=Aggr( NODISTINCT Max({<CALENDAR_YEAR_MONTH_CD = ,YDAY = ,Month_Name = , Year_Name =>}YDAY),Month_Name, Year_Name),YDAY))))

Highlighted
Contributor II

## Re: Getting max field (On calculated field) while opening the Document

try this way .. add an action on open --> select in field -->Date field --> in the string --> use your your calculation that has been used for calculated dimension.

Highlighted
Contributor III

## Re: Getting max field (On calculated field) while opening the Document

Since this is calculated one.. We dont have any specific name for this.. That is the challenge i face now..

Highlighted
Contributor III

## Re: Getting max field (On calculated field) while opening the Document

Anil - Is there a way of converting this to variable and calling the max of Variable while opening the document ?

Highlighted
Contributor II

## Re: Getting max field (On calculated field) while opening the Document

Yes I agree bharani, the calculated field is based on YDAY which is a date, so I believe that shud be your field to use

I have this =max(if(Date>'08/01/2015' and Date<'04/15/2017',Date))  in on open action its working my original Date has some thousand dates but I took the range I wanted and calculated it .. its working...