# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
New Contributor II

## Max and if not working

Hi Iam Doing a set analysis i have a isssue

when iam using this it is working

Max({<ServiceDayNum={">=\$(=Max(ServiceDayNum)-6) <=\$(=Max(ServiceDayNum))"}>}OTPDenominator)

When i put in If condition like this it is not working

=If(GetSelectedCount(PeakType)=0

, Max({<PeakType={'Peak'},ServiceDayNum={">=\$(=Max(ServiceDayNum)-6) <=\$(=Max(ServiceDayNum))"}>}OTPDenominator)
, Max(OTPDenominator)

)

Thanks

Tags (2)
3 Replies
Contributor

## Re: Max and if not working

Can you please try below expression and let me know it works for you or not.

=If(GetSelectedCount(PeakType)=0
,if(PeakType='Peak' and (ServiceDayNum >= Max(ServiceDayNum)-6 and ServiceDayNum < Max(ServiceDayNum)),Max(OTPDenominator) ) , Max(OTPDenominator)
)
MVP

## Re: Max and if not working

First thing, you have tested this expression

``Max({<ServiceDayNum={">=\$(=Max(ServiceDayNum)-6) <=\$(=Max(ServiceDayNum))"}>}OTPDenominator)``

but you are using this in your if statement (with additional set analysis on PeakType)

``Max({<PeakType={'Peak'},ServiceDayNum={">=\$(=Max(ServiceDayNum)-6) <=\$(=Max(ServiceDayNum))"}>}OTPDenominator)``

Secondly, it might help to know what you are getting and what you are expecting to see?

Community Manager

## Re: Max and if not working

@anirudhrao92  Are you using Qlik Sense or View? I would like to move this into the correct product forum.

Sue Macaluso