Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
arethaking
Creator II
Creator II

Sum(Aggr(PD * Count(PD),PD))

Hi All,

What is the meaning of this expression?

Sum(Aggr(PD * Count(PD),PD))

1 Solution

Accepted Solutions
Kushal_Chawda

If you have sample data for this, you can create the straight table with Dimension & above expression and try to break the expression to understand how it's working

first see, what PD * Count(PD) is giving,

then see, what  Aggr(PD * Count(PD),PD) is giving

Finally see what is entire expression is giving

View solution in original post

5 Replies
varshavig12
Specialist
Specialist

It will simple count PD and aggregate it with the same.

Example:

Here 1 has occurred twice , so its 1*2=2

and 2 has occurred once so its 2*1=2

# has occurred twice so, 3*2=6

and so on:

LOAD * INLINE [

PD

1

2

3

4

1

3

];

varshavig12
Specialist
Specialist

It will simply count the PD and multiply with its count.

Kushal_Chawda

If you have sample data for this, you can create the straight table with Dimension & above expression and try to break the expression to understand how it's working

first see, what PD * Count(PD) is giving,

then see, what  Aggr(PD * Count(PD),PD) is giving

Finally see what is entire expression is giving

sasiparupudi1
Master III
Master III

aggr statement is similar to sql group by.. if you are familiar with sql.

PD * Count(PD) seems to be wrong..


select  PD,Count(Your Field)

group by (PD)

hth

Sasi

jonathandienst
Partner - Champion III
Partner - Champion III

This looks like a more complex (and less efficient) way to compute Sum(PD). For example, with this load script:

LOAD * INLINE

[

  PD

  .1

  .1

  .1

  .2

  .2

  .3

  .3

];

Sum(Aggr(PD * Count(PD), PD)) = 3 * .1 + 2 * .2 + 2 * .3 = 1.3

Sum(PD) = (.1 + .1 + .1) + (.2 + .2) + (.3 + .3) = 1.3

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