Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Top 30 merchants

I took Merchant as dimension and sum(Sales) as my expression. And also suppressed the null values for Merchant. I got the total as 123030099402.72.

I want to display the sum(Sales) of the top 30 merchants by Sales in a text box as well.

So I did =sum({<Merchant = {"=Rank(sum(Sales)) <=30"}>}Sales).

But I got a very weird value of 32428895761.17. Is it because of nulls.

What is the correct expression in a text box for sum(Sales) for largest 30 merchants excluding nulls?

10 Replies
swuehl
MVP
MVP

The overall total seems to be larger than the TOP30 Merchant total. Isn't this expected?

Not applicable
Author

In the straight table, I used dimension limits and I'm only showing values for largest 30.

sunny_talwar

Try this same expression (this one -> =Sum({<Merchant = {"=Rank(Sum(Sales)) <=30"}>}Sales)) in a straight table with Merchant as dimension to see if you see any difference between this new straight table vs the straight table you created using dimension limits.

Not applicable
Author

Hi Sunny,

Its returning the same value but I can't tie up the numbers when I'm suppressing the values in the straight table.

=Sum({<Merchant  -=  {' '},Merchant = {"=Rank(Sum(Sales)) <=30"}>}Sales)

swuehl
MVP
MVP

I believe you can't use two field modifiers on the same field within the same set modifier (pair of <...>), I think only the second will be considered.

Why do you need to exclude Merchant ' '? Can't you clean your data in the load script instead?

sunny_talwar

How about this?

=Sum({<Merchant = {"=Rank(Sum({<Merchant  -=  {' '}>}Sales)) <=30"}>}Sales)

Not applicable
Author

Thanks Sunny, But it didn't work .

el_aprendiz111
Specialist
Specialist

Hi,

     =
     
NUM(
          
Sum(
            {<
               
Merchant =
                       {
"=RANK(SUM({$<Merchant={'*'}-{''}>}Sales),4)<=30"}
             >}
         
Sales),

      '#.##0'
)

Not applicable
Author

Looks like the condition works for straight table but not for text box.