Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Not applicable

display of previous data from selected one

i wish to display the data of the previous 12 months.

Upon selecting any month-year(as dimension) i must get data on a line/bar/combo chart of the past 12 months.

I have tried rolling 12 months but its not the sum of past 12 months which i want. i want the chart to display the entire graph data from the selected month to past 12 months.

i am having trouble writing the proper set analysis.

my dimension is [month year]  (jun 2016 type) and measure is [Year Salary]

i am writing my set as such : sum({<  [month year]= "  --This is the part am messing up-- " >}[Year Salary])

please help

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: display of previous data from selected one

Hi Pooja,

Try this expression,

sum({<@_Date={">=$(=Date(AddMonths( Max(DateField),-12),'DD/MM/YYYY'))<=$(=Date(Max(DateField),'DD/MM/YYYY'))"},MonthField=,QuarterField=,YearField=>}[Year Salary])

View solution in original post

10 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: display of previous data from selected one

See this document: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand
Highlighted

Re: display of previous data from selected one

Can you please send me your application

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
tyagishaila
Valued Contributor

Re: display of previous data from selected one

Try it

Sum( {<Month = {'>=$(=Addmonths(Datefield,-12))<=$(=Month(Datefield))'} >} [Year Salary])

Highlighted
Not applicable

Re: display of previous data from selected one

I tried doing this, however I didn't work the way am looking for.

upon selection, it just shows me that current year. I want it to work in such a way that upon selecting jun 2005, it should display the line graph from jun 2004 till jun 2005.

Highlighted
Partner
Partner

Re: display of previous data from selected one

Hi Pooja,

Try this expression,

sum({<@_Date={">=$(=Date(AddMonths( Max(DateField),-12),'DD/MM/YYYY'))<=$(=Date(Max(DateField),'DD/MM/YYYY'))"},MonthField=,QuarterField=,YearField=>}[Year Salary])

View solution in original post

Highlighted
Not applicable

Re: display of previous data from selected one

I saw the document. However, it is adding the previous months total.

I don't want that. I just want t to display the last n period graph upon selecting any [monthyear].

Upon selecting the year jun 2005, i want the graph to display the previous n period graph pattern.

Highlighted
Not applicable

Re: display of previous data from selected one

monthfield, quaterfield are qlik sense functions? and what is @_Date?

Highlighted
Not applicable

Re: display of previous data from selected one

kindly please explain your logic of using monthfield, quarterfield, yearfield. It is working perfectly as I wanted.

THANK YOU SO MUCH

Highlighted
Partner
Partner

Re: display of previous data from selected one

You can use the before expression with out those field that you are mentioned in your last reply.

Here @_Date is a datefield of Database,