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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
louisernould
Contributor III
Contributor III

aggr formula for each line

hi everybody,

I have a large table with x dimensions:

model, article, and Density.

ModelArticleDensity
Aa11
Aa23
Aa35
Aa42
Bb51
Bb62

i'm looking for a formula which can tell me how many articles I have in each model, when the Density is under the 1st fractile (One fractile distinct by model).

so something like that:

ModelNb of articlenb of article under the 1st fractile
A41
B20

i'm already trying with this formula: count({<Density={"<$(=fractile(aggr(Sum(Density),[Artcile]), 0.1))"}>}[Article])

But, the result returns the number of article when the density in under the 1st fractile for all the base, and not for each model:

ModelNb of articlenb of article under the 1st fractile
A41
B21

if someone can help me ? you will be so nice !!!

Thank you

Regards

Louis

1 Solution

Accepted Solutions
louisernould
Contributor III
Contributor III
Author

Hi ! Thank marcus_sommer‌ for this link, it helped me

because I found it !!!!

the final formula is : Count(Aggr(If([Density]< Fractile(TOTAL <Model> Density,0.1), [Article]), [Model],[Article]))


I just saw rwunderlich‌'s answer, it's the same

thanks for your time guys !

Louis

View solution in original post

5 Replies
marcus_sommer

Maybe this is helpful: Re: Average of fractile

- Marcus

Anil_Babu_Samineni

Can I know the use of 0.1 value

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Its for the fractile function specifying that the expression needs to find 10th percentile.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The issue here is that your DSE $() expression will be evaluated only once for the entire chart, not per dimension. To evaluate on a Dimensional basis, you will have to change to using if().

sum(

aggr(

  if(Density<

  Fractile(TOTAL<Model>Density,0.1)

  ,1,0)

,Model,Article, Density)

)

BTW, I think "1" is the correct value when using the .1 fractile. See attached.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

louisernould
Contributor III
Contributor III
Author

Hi ! Thank marcus_sommer‌ for this link, it helped me

because I found it !!!!

the final formula is : Count(Aggr(If([Density]< Fractile(TOTAL <Model> Density,0.1), [Article]), [Model],[Article]))


I just saw rwunderlich‌'s answer, it's the same

thanks for your time guys !

Louis