# Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

New Contributor II

## How to use max() function in qliksense?

How to use max() function with where clause in load editor in Qliksense ??

where Quarters=Max(Quarters)

Getting error in above expression.

Kindly help.

8 Replies
MVP

## Re: How to use max() function in qliksense?

You cannot reference Quarters and Max(Quarters) in the same load statement. You will need to do this in two steps -- the process will depend in the structure of your data and whether you want a global max or a max by some grouping.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Honored Contributor III

## Re: How to use max() function in qliksense?

New Contributor II

## Re: How to use max() function in qliksense?

I need to calculate the max value of quarter and use it in the measure.

How do I do it.?
Is there any way to calculate in the expression??

MVP

## Re: How to use max() function in qliksense?

>>the process will depend in the structure of your data and whether you want a global max or a max by some grouping.

The more detail you provide, the more useful the suggestions.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Honored Contributor III

## Re: How to use max() function in qliksense?

you can directly use that condition in set analysis if you have calculated Quarter field in your calendar script

New Contributor II

## Re: How to use max() function in qliksense?

I need to calculate the measure which should represent the data as per the maximum value of quarter.

The expression for the measure is:
count(distinct [Customer Group])

The expression I am trying in expression editor is :

count( Quarter=max(Quarter) distinct [Customer Group])

But not getting the desired result.

Kindly help.

New Contributor II

## Re: How to use max() function in qliksense?

The expression I m using in the expression editor is:

count( Quarter=max(Quarter) distinct [Customer Group])

But its not working fine.

Honored Contributor III

## Re: How to use max() function in qliksense?

Try,

count( distinct  {<Quarter={"\$(=max(Quarter))"} >} [Customer Group])