# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## Class Function using Aggr

Hi,

I am using following expression in the dimension

=IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))=0,'0',
IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))<50 and(Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))>0,
Class((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo)),25,''),
IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))>50, Class((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo)),25,''))))

Things looks fine if I plot this in table but When I am plotting above expression as dimension it is giving me the following ranges:

0
25<=<50                     ---------- Here 0-25 slab is missing on dimension. Please  explain
50<=<75

Tags (1)
4 Replies
Contributor III

## Re: Class Function using Aggr

Hi,

try this,

=IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))=0,'0',

IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))<=25 and(Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))>0,

Class((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo)),25,''),

IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))>50, Class((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo)),25,''))))

Regards,

Contributor III

## Re: Class Function using Aggr

Or try this,

=IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))=0,dual('0',1),

IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))<=25 and(Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))>0,dual('0-25',2),

IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))<=50 and(Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))>=26,dual('26-50',3),

IF((Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))<=75 and(Aggr(Max(Date),SerialNo)- aggr(Min(Date),SerialNo))>=51,dual('51-75',4)))))

Esteemed Contributor II

## Re: Class Function using Aggr

What does this do?

=AGGR( CLASS ( Max(Date)  - Min(Date),25) , SerialNo )

MVP

## Re: Class Function using Aggr

May be this

=Aggr(If((Max(Date) - Min(Date)) = 0, '0', Class((Max(Date) - Min(Date)), 25)), SerialNo)