Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I am trying to find the week in 2016 in which the total traffic volume per country was the highest one.
To find the max traffic volume I am using:
MAX(aggr(sum({<[YEAR]={'2016'}>}[TRAFFIC]),WEEK,COUNTRY))
and in order to find the week I am using:
FirstSortedValue(WEEK, -Aggr(sum({<[YEAR]={'2016'}>}[TRAFFIC]),WEEK))
The problem is that this second function works only when a specific country is filtered, but if nothing is filtered it gives me back "-".
I would like to have all the values, without having to filter them...
Any idea?
Thanks in advance
My bad, can you try this (I misplaced Country in my previous response):
FirstSortedValue(WEEK, -Aggr(sum({<[YEAR]={'2016'}>} [TRAFFIC]), Country, WEEK))
May be this:
= FirstSortedValue(WEEK, -Aggr(sum({<[YEAR]={'2016'}>}[TRAFFIC]), YEAR, COUNTRY, [TRAFFIC]))
Hi,
it works only for few rows:
it gives me back a value for all the countries, but sometimes it is a wrong value...
How about this:
FirstSortedValue(WEEK, -Aggr(sum({<[YEAR]={'2016'}>} Country, [TRAFFIC]),WEEK))
Hi,
the expression is OK for Qlik, but it gives me back no results, even if I filter something....
Would you be able to share a sample?
Oops i missed the week May be try this:
= FirstSortedValue(WEEK, -Aggr(Only(sum({<[YEAR]={'2016'}>}[TRAFFIC])) , Country, WEEK , [TRAFFIC]))
In this case no results at all
all the lines gives me back this : "-"
Actually I am not able to attach the qvw file.
Here is an example of what I need:
| COUNTRY | TOP TRAFFIC VOLUME (min) | WEEK |
| A | 1054 | 10 |
Having for this specific country these values:
| 15 | 91 |
| 14 | 208 |
| 13 | 103 |
| 12 | 64 |
| 11 | 30 |
| 10 | 1,054 |
| 9 | 235 |
| 8 | 301 |
| 7 | 259 |
| 6 | 157 |
| 5 | 213 |
| 4 | 135 |
| 3 | 133 |
| 2 | 153 |
| 1 | 138 |
As sunny said, it would be good if you can share your sample app for a quick look.
Can you try below as well?
What is your date field in your table like,
= FirstSortedValue(WEEK, -Aggr(sum({<[YEAR]={'2016'}>}[TRAFFIC]) , Yourdatefield , WEEK , [TRAFFIC]))