Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

piyush_s11
New Contributor

NEED URGENT SOLUTION : show last 6 months data from currently selected month in a chart

Hi,

I want to show last 6 months data from the currently selected month in a chart.

Unfortunately file size is high because of which I am not able to attache the qlik file.

Please find attached screenshot for the same.

Please let me know any other detail required

Require your help to solve.

Hi All,

I have attached a sample qlik application.

Request your kind help on this.

Also please note that, if I select a month Feb for year 2018 & then it should show me the data from Sept 2017 to Feb 2018.

Thanks.

19 Replies
yogiwasaikar
New Contributor III

Re: show last 6 months data from currently selected month in a chart

Hi Piyush,

Will you please provide shredded sample data, it would be help-full.

Thanks and regards,

Yogendra W.

dilipranjith
Valued Contributor II

Re: show last 6 months data from currently selected month in a chart

See below example. Suppose order date is the selection you are making

declare 2 variables

vTestDate - =if(GetSelectedCount(OrderDate)=1,OrderDate,0)

vTestDateMinus6   -   =if(GetSelectedCount(OrderDate)=1,Date(AddMonths(OrderDate,-6)),0)

your expression

if(vTestDate=0, Sum( OrderRecordCounter),Sum( {<OrderDate={"<=$(=vTestDate) >=$(=vTestDateMinus6)"}>} OrderRecordCounter))

the if condition is to show all the values if no order date is selected

Hope it helps

piyush_s11
New Contributor

Re: show last 6 months data from currently selected month in a chart

Hi Yogendra,

Please find attached sample qlik file.

Thanks,

Piyush

piyush_s11
New Contributor

Re: show last 6 months data from currently selected month in a chart

Hi Dilip,

Thanks for your reply.

I have attached sample qlik file for your reference.

dilipranjith
Valued Contributor II

Re: show last 6 months data from currently selected month in a chart

Did a quick check of you app. You cant have month as a dimension as well as a set modifier.

You can use a variation of my example to create a year month variables start and end and use that in the set analysis

piyush_s11
New Contributor

Re: show last 6 months data from currently selected month in a chart

Hi Dilip,

Could you please elaborate more. Also it would be helpful if you do some changes in my app & rectify it which will give me desired output. Also you have mentioned of your variety of example, could you please share those as well so that it would be helpful for future app development.

MVP
MVP

Re: show last 6 months data from currently selected month in a chart

Create a Date field like:

Load

          MakeDate(Year, MonthNumber) as Date

Then at the UI, you could use simpler expression like:

=Sum({<Date={">$(=MonthEnd(Max(Date),-6)) <=$(=Date(Max(Date)))"}>}Actual)

piyush_s11
New Contributor

Re: show last 6 months data from currently selected month in a chart

Hi Tresesco,

Thanks for your reply. Unfortunately the formula provided by you is not working as expected.

MVP
MVP

Re: show last 6 months data from currently selected month in a chart

Have you created a date field as suggested? Could you share your sample with date field to work on?

Community Browser