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: 
Sammy
Contributor
Contributor

Formula within set analysis not working

Hi all

The following expression works:

=Count( {<Brand= {CD}>} Aggr( Count(Distinct Code),Shop,Code))  // Result=899

=Firstsortedvalue (Brand, -Aggr(Count({<Brand=>} Code), Brand), 1) //  Result = CD

 

This one is not working. I just replaced the brand CD on the first expression for the second expression which the result is CD

=Count(

{<Brand=
{
"${=
Firstsortedvalue (Brand, -Aggr(Count({<Brand=>} Code), Brand), 2)
}"
}

>}

Aggr( Count(Distinct Code),Shop,Code))  // Result = 0

 

What am I doing wrong?

Thanks

 

 

1 Solution

Accepted Solutions
Sammy
Contributor
Contributor
Author

Hi, 

I solved my problem using variables

 

=Count({<Brand={$(vBrand2) } Brand)

Where vBrand2 was defined as a variable =Firstsortedvalue (Brand, -Aggr(Count({<Brand=>} Code), Brand), 2)

Thanks

View solution in original post

3 Replies
Lizz_Johnston
Employee
Employee

Hello,

 

Can you post a sample app with your expressions  for us to take a look at? 

Wlad_Masi
Former Employee
Former Employee

Maybe something like this:

=Count({<Brand= {"=$(Firstsortedvalue (Brand, -Aggr(Count({<Brand=>} Code), Brand), 2))"}>}Aggr( Count(Distinct Code),Shop,Code))

To help users find verified answers, please don't forget to mark a correct resolution or answer to your problem or question as correct.
Sammy
Contributor
Contributor
Author

Hi, 

I solved my problem using variables

 

=Count({<Brand={$(vBrand2) } Brand)

Where vBrand2 was defined as a variable =Firstsortedvalue (Brand, -Aggr(Count({<Brand=>} Code), Brand), 2)

Thanks