Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rlam1234
Contributor II
Contributor II

Get max count for a week

I have a chart that has the following:

  • A date dimension

  • A measure that does the count for each day. The expression in the measure is:  Count({$<CodeDev={1} >} distinct id)

2020-09-03_16-14-19.png

 

I want to get the max count for each week. 

  • Dimension will be: WeekEnd(CalendarDate)

This will make each row the end of a week. Without changing the measure, I get this:

2020-09-03_16-22-07.png

How do I set the expression to get the max count for a week? For example, in second chart, I want 8/29/2020 to show 3807, because the max daily count for 8/23-8/29 (in first chart) is 3807.

Any advice appreciated. 🙂

1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

HI @rlam1234 

What you are wanting there is the AGGR function. Strongly suggest looking up the help file for that function, so you understand how it works, but what I think you need is:

max(aggr(Count({$<CodeDev={1} >} distinct id), Date))

This will get the counts for each date and then the max will get the highest of those, if you then have Week as a dimension it will give the highest daily count in each week.

Steve

View solution in original post

2 Replies
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

HI @rlam1234 

What you are wanting there is the AGGR function. Strongly suggest looking up the help file for that function, so you understand how it works, but what I think you need is:

max(aggr(Count({$<CodeDev={1} >} distinct id), Date))

This will get the counts for each date and then the max will get the highest of those, if you then have Week as a dimension it will give the highest daily count in each week.

Steve

rlam1234
Contributor II
Contributor II
Author

Thanks Steve. That's what I needed to do.