Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

brijeshma
Contributor

if condition with Aggregation Expression

Hi All..

I Want to create funnel chart ... so i have a Inline Table Say,

FunnelView:

Load * Inline

[

"KPI Funnel", FunnelViewDimOrder

"Spend", 1,

"Sessions", 2,

"Leads", 3,

];

And in funnel chart .. I have a Dimension [KPI Funnel]

And Expression :

if([KPI Funnel]='Leads', Count(distinct LeadID),

if([KPI Funnel]='Spend',Sum(Spends),if([KPI Funnel]='Sessions',Sum(Aggr(Visits,VisitFull))   )))...

Leads and Spend giving  a Output but Session is Showing 0 ... for Session exp : Sum(Aggr(Visits,VisitFull)) is

Correct because i am getting a proper value without if condition in other chart .. i tried Writing like this as well

Smiley Frustratedum(if([KPI Funnel]='Sessions',(Aggr(Visits,VisitFull)))) ... its giving value but not correct value kindly help me for the same...

6 Replies
MVP
MVP

Re: if condition with Aggregation Expression

>>Sum(Aggr(Visits,VisitFull)) is Correct because i am getting a proper value without if condition in other chart


Your expression looks OK - Sum(If()) is not correct in this context.

What are the dimensions on the table where this expression works?

Why an Aggr()?

MVP
MVP

Re: if condition with Aggregation Expression

Also, I would load the dimension like this:

FunnelView:

Load Dual(Text, Order) as "KPI Funnel"

Inline

[

Text, Order

Spend, 1,

Sessions, 2,

Leads, 3,

];

And then used this rather than a nested if:

=Pick("KPI Funnel",

     Sum(Spends),

     Sum(Visits),               // why do you nee an Aggr??

     Count(distinct LeadID)

)


brijeshma
Contributor

Re: if condition with Aggregation Expression

Hi Jonathan ,

I have a two table from where i am getting an value .. without Aggr i am not getting an proper value..

so i have to use the same.. cant we use aggr in if else...

brijeshma
Contributor

Re: if condition with Aggregation Expression

Hi,

Aggr expression gives correct output on all dimension say , Date Channel and rest

brijeshma
Contributor

Re: if condition with Aggregation Expression

Hi can anyone please update me on my query

Re: if condition with Aggregation Expression

Hi,

You can try this.


Sum(Aggr(Sum(Visits),VisitFull))


Regards,

Kaushik Solanki

Community Browser