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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
razvan_brais
Creator III
Creator III

Last 7 days average barchart

I`m trying to calculate last 7 days average of sales and put it in a bar chart , but when I add the expression it shows values for every day. I want to show just one bar for the average.

This is the expression:

sum({<DATE = {">=$(=Date(GetFieldSelections(DATE)-7))<=$(=Date(GetFieldSelections(DATE)))"}>} Sales) / 8

What is wrong , or what am I doning wrong?

Thank you

Labels (1)
14 Replies
giakoum
Partner - Master II
Partner - Master II

aggr(sum({<DATE = {'>=$(vMaxDatePrev)<=$(vMaxDate)'}>} Sales) / 8, Week)

Anonymous
Not applicable

Could you share one example of your app plz?

sunny_talwar

Are you looking for something like this?

Capture.PNG

razvan_brais
Creator III
Creator III
Author

I don`t understand why it shows me only two bars , the one for today and the one for 7 days ago , but the average is not shown

this is the exact query that I wrote

=If(Dimensionality() = 0,

Avg({<DATE = {"$(='>=' & Date(Max(DATE)-7) & '<=' & Date(Max(DATE)))"}, LEVEL1={'Electronics'}>}if(CUST_TYPE='P',SALES,SALES*-1)),

Sum({<DATE = {"$(=Date(Max(DATE)-7))", "$(=Date(Max(DATE)))"}, LEVEL1={'Electronics'}>}if(CUST_TYPE='P',SALES,SALES*-1)))

sunny_talwar

Apologize, I should have pointed that out. Select 'Show Total' on the dimension limits tab

Capture.PNG