Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
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
Support (Former)
Support (Former)

Hello,

 

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

Wlad_Masi
Digital Support
Digital Support

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

View solution in original post