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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
arsa6978
Contributor III
Contributor III

Difference between Aggregate Functions in Dimension and Formel

Hi every one,

i have a question as just a beginner, please take a look at my qvw.

There is a difference if i put aggr Function in Dimension or in Fomel.

count( DISTINCT{$ < BelegID={"=aggr(COUNT([BelegID]), %KundeID) = 1 "}, _Launch = {1} >} [%KundeID])

i want to get count of customers with 1,2, 3 and more orders after launch.

Which one is correct? Any why?

Thanks for your responses!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe, or if you need to filter the BelegID within the CompKey filtering:

count( DISTINCT{$ <  %CompKey={"=count({< _Launch = {1}, BelegID = {'=Sum(SummeCent)>0'} >}[BelegID]) = 1"}, _Launch = {1} > } [%CompKey])

View solution in original post

8 Replies
swuehl
MVP
MVP

You have %KundeID that are linked to more than 1 FirmaRef

%KundeID Count(DISTINCT FirmaRef)
3
6135672
6137412
6140752
6141302

So you need to create a composite key made of FirmaRef and %KundeID if you want to count the BelegeID correctly per company in a set modifer advanced search.

Have a look at attached modified sample.

arsa6978
Contributor III
Contributor III
Author

Hi swuehl,

it works, thanks!

I need now all Orders with SumCent > 0. How could i do this in Set Analysis?

Please have a look at attached modified sample.

swuehl
MVP
MVP

Maybe like

Count({<BelegID = {"=Sum(SummeCent)>0"}>} DISTINCT BelegID)

arsa6978
Contributor III
Contributor III
Author

Hello again,

for me it is more interesting to know, how could i combine SumCent > 0 with this Expression:

count( DISTINCT{$ < %CompKey={"=count({< _Launch = {1}>}[BelegID]) = 1"}, _Launch = {1} > } [%CompKey])

to concider SumCent > 0 and _Launch = {1}

Thanks!

swuehl
MVP
MVP

What would be the internal grouping entity for your SumCent >0 comparison?

I mean, if you would need to create a straight table where something like

=If(Sum(SumCent)>0,1,0)

would be the expression, what would be the correct dimension?

Use this field dimension in your set expression with an advanced search

{< FIELD = {"=Sum(SumCent)>0"} >}

arsa6978
Contributor III
Contributor III
Author

Do you mean with advanced search something like this?

count( DISTINCT{$ <  BelegID = {"=Sum(SumCent)>0"}, %CompKey={"=count({< _Launch = {1}>}[BelegID]) = 1"}, _Launch = {1} > } [%CompKey])

pls have a look at customers2 table attached.

swuehl
MVP
MVP

Maybe, or if you need to filter the BelegID within the CompKey filtering:

count( DISTINCT{$ <  %CompKey={"=count({< _Launch = {1}, BelegID = {'=Sum(SummeCent)>0'} >}[BelegID]) = 1"}, _Launch = {1} > } [%CompKey])

arsa6978
Contributor III
Contributor III
Author

Exactly, thank you very much!