Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Pomna
Creator III
Creator III

last month average

Hello experts I need your help getting last month average customer satisfaction rating for a bar chart. Below is the code I have which is not giving me the desired result. 

Thanks.

sum({$<Date={"$(=Max(month)-1)"}>}[CusSat Rating])/

count( {$< Date={"$(=Max(month)-1)"}>}[CusSat Rating])

4 Replies
sunny_talwar

What is Date? Is it a date which include every single day of the month? or is this month start or month end? Also, what kind of chart are you trying to use this expression in? What are the dimensions of the chart?

Sue_Macaluso
Community Manager
Community Manager

@Pomna  are you using Qlik Sense or View, I'd like to move this into the correct product forum

Did you find a solution to your question? Mark the solution as accepted : and if you found it useful, press the like button!
Pomna
Creator III
Creator III
Author

qlik sense

Pomna
Creator III
Creator III
Author

Am trying to get a bar chart that would show first quarter average and last month average. My dimension is service desk which shows different service desks like Solutions, Architecture, Data and Applications.  I do not get the desired result

I need to get last month average customer satisfaction rating and my code looks like this

sum({$<Date={"$(=Max(month)-1)"}>}[CusSat Rating])/
count( {$< Date={"$(=Max(month)-1)"}>}[CusSat Rating])

I also need t get last quarter average customer satisfaction rating my code looks like this

Sum({<[Date]={">=$(=QuarterStart(Today(),-1)) <=$(=QuarterEnd(Today(),-1))"}>}[CusSat Rating])/
Count({<[Date]={">=$(=QuarterStart(Today(),-1)) <=$(=QuarterEnd(Today(),-1))"}>}[CusSat Rating])

My calendar looks like this 

CanonicalCalendar:
LOAD
"Canonical Date",
"Canonical Year",
"Canonical Month",
"Canonical Day",
"Canonical Quarter",
"Canonical Year To Date Flag",
"Canonical Week",
"%Canonical Date Key",
"Canonical Year and Month",
If("Canonical Date" <= Today()
And "Canonical Date" >= SetDateYear(Today(), Year(Today())-1), 1, 0) As Last12Months