Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Aanchal
Contributor II
Contributor II

Limit top 10 By measure (Set Expression)

Dear , 

This is my set Expression

=count({<[Date Stamp] ={">=$(=Date(Today()-90,'DD-MM-YYYY'))<=$(=Date(today(),'DD-MM-YYYY'))"}>}[Color Priority])

for total no. of colour instances   i have to show top 10 . 

i used this expression 

=Aggr(Rank(count({<[Date Stamp] ={">=$(=Date(Today()-90,'DD-MM-YYYY'))<=$(=Date(today(),'DD-MM-YYYY'))"}>}[Color Priority])) <=10,[Color Priority])

Its not working . Please Suggest.

Labels (1)
15 Replies
sidhiq91
Specialist II
Specialist II

@Aanchal  One small suggestion.

Use a Calculated Dimension as below:

Aggr(if(Rank(count({<[Date Stamp] ={">=$(=Date(Today()-90,'DD-MM-YYYY'))<=$(=Date(today(),'DD-MM-YYYY'))"}>}

[Color Priority])) <=10,[Color Priority]),[Color Priority])

And Measure would be:

count({<[Date Stamp] ={">=$(=Date(Today()-90,'DD-MM-YYYY'))<=$(=Date(today(),'DD-MM-YYYY'))"}>}[Color Priority])

If this resolves your issue, please like and accept it as a solution.

Aanchal
Contributor II
Contributor II
Author

Hi , 

Thanks for the quick response . 

this is not limiting to 10 .

sidhiq91
Specialist II
Specialist II

@Aanchal  Could you please send me some sample data please?

SunilChauhan
Champion II
Champion II

Can we not achive this by Limiting  in Dimension

IamBack_0-1661934042145.png

 

use formula without Rank i.e.

count({<[Date Stamp] ={">=$(=Date(Today()-90,'DD-MM-YYYY'))<=$(=Date(today(),'DD-MM-YYYY'))"}>}[Color Priority])

and limit dimension for  top 10 as in above screen shot.

See the example app also

Sunil Chauhan
BrunPierre
Partner - Master
Partner - Master

@Aanchal I concur with @SunilChauhan  on restricting the display values using dimension limits.

Alternatively, maybe this

IF(RANK(Count({<[Date Stamp] ={">=$(=Date(Today()-90,'DD-MM-YYYY'))<=$(=Date(today(),'DD-MM-YYYY'))"}>}[Color Priority]))<=10,Count({<[Date Stamp] ={">=$(=Date(Today()-90,'DD-MM-YYYY'))<=$(=Date(today(),'DD-MM-YYYY'))"}>}[Color Priority]))

Aanchal
Contributor II
Contributor II
Author

This is a measure.

Aanchal
Contributor II
Contributor II
Author

its showing only 1 as output 

BrunPierre
Partner - Master
Partner - Master

What is the expected output?

Aanchal
Contributor II
Contributor II
Author

 

 

This is desired output , but i have to display only top 10  on basis of no. of instances. 

where my no. of instances is a set expression a measure 

=count({<[Date Stamp] ={">=$(=Date(Today()-90,'DD-MM-YYYY'))<=$(=Date(today(),'DD-MM-YYYY'))"}>}[Color Priority])

Aanchal_1-1662005520616.png