Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

siddharthsoam
Contributor

Can we put condition in max function

Hi

I want to apply a condition in max function.

Max({<[Fiscal Year]='FY16'>}( mid(Quarters,2)))

Ideally it should give me 4, but its not returning any value.

1 Solution

Accepted Solutions
shraddha_g
Honored Contributor III

Re: Can we put condition in max function

have a look at the attached.

75 Replies
devarasu07
Honored Contributor II

Re: Can we put condition in max function

Hi,

You have missed that curly bracket, just add like below try again. tks

Max({<[Fiscal Year]={'FY16'}>}(mid(Quarters,2)))

siddharthsoam
Contributor

Re: Can we put condition in max function

Sorry Devarasu forgot that but I am still facing another problem. The following max condiotion is not working in the expression with concat

Concat(Distinct 'Q' & if( (( mid(Quarters,2))-1)>0 and [Fiscal Year]='FY17', ( mid(Quarters,2))-1, (Max({<[Fiscal Year]={'FY16'}>}(mid(Quarters,2))))),',')

Its showing nested aggregation not allowed.

shraddha_g
Honored Contributor III

Re: Can we put condition in max function

what are you trying to do here?

siddharthsoam
Contributor

Re: Can we put condition in max function

Hi Shraddha,

I have my quarters as Q1,Q2,Q3,Q4 so I am generating previous quarters for the respective selection. Mid function is used to fetch 1 from Q1. For Q0 it should show me quarter 4 or the maximum quarter for year FY16

shraddha_g
Honored Contributor III

Re: Can we put condition in max function

do you have access to script?and do you have date field in data model?

siddharthsoam
Contributor

Re: Can we put condition in max function

Yes I have access to script , I don't have any date field in data model

pradosh_thakur
Valued Contributor III

Re: Can we put condition in max function

Hi sidharth

do you want only the previous quarter for the date selected in a text box or something. This doesn't need to be this complicated. Can you share the input and expected output.

regards

Pradosh

shraddha_g
Honored Contributor III

Re: Can we put condition in max function

MonthField?

siddharthsoam
Contributor

Re: Can we put condition in max function

Yes I have a month field