Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

priqvqlik
Contributor

average data

I want to calculate data which would be average for present week. how to achieve this ?

1 Reply
MVP
MVP

Re: average data

Either use Avg() function or aggregate your measure and divide by e.g. number of distinct dates in your period:

Average – Which average?

If you want to limit the data to the present week, either use a conditional function or set analysis:

=Avg( If( DateField >= Weekstart(Today()) and DateField <= Weekend(Today()), ValueField))

or

Avg({<DateField  = {">=$(=Date(Weekstart(Today())))<=$(=Date(Weekend(Today())))"} >} ValueField)

See also

A Primer on Set Analysis

Dates in Set Analysis