Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
mohsinqlik
Partner - Creator
Partner - Creator

Show Data of 6 months back in current month

Dear All,

I have dimension month,

I need to show data as follow :

Jan 2015 should show data from month Jul 2014, Feb 2015 should data from month Aug 2014.

Similarly Jul 2015 should show data of Jan 2015 and so on.

I have to do it in chart i.e on front end

If anyone have idea how do it in front end using set anaysis then please share.

17 Replies
sunny_talwar

Have you tried using Above Function may be?

Above(yourCurrentExpression, 6, 0) assuming you have Month Year as your dimension

mohsinqlik
Partner - Creator
Partner - Creator
Author

Thanks for the reply. Above Function works for current year value it works fine i.e from Jan 2015 till Jun are shown in  Jul-2015 to Dec 2015 month columns but for Jan 2015-Jun 2015 it does not show any values. As it should show data of Jul 2014-Dec 2014 in Jan 2015 till Jun 2015 Month columns

sunny_talwar

That is why it is important you are using a correct dimension. If you are not already doing this try this:

Within your MasterCalendar:

MasterCalendar

LOAD TempDate as Date,

          ...

          MonthName(Date) as MonthYear

Resident ...

Now use MonthYear as your dimension

If you don't have a MasterCalendar, use MonthName() function directly into your fact table where you have all the dates.

But the idea is, you need to use MonthYear as dimension.

I hope this helps.

Best,

Sunny

sunny_talwar

Another thing, are you making a selection on the current year???? If you are then this might help you better:

If(YourExpression > 0, Above(YourExpression*, 6, 0)) where YourExpression* within Above will have set analysis statement {<Year = , Date = , MonthYear = >}

mohsinqlik
Partner - Creator
Partner - Creator
Author

After taking MonthYear as dimension same values are being displayed.

sunny_talwar

What about this?

Another thing, are you making a selection on the current year???? If you are then this might help you better:

If(YourExpression > 0, Above(YourExpression*, 6, 0)) where YourExpression* within Above will have set analysis statement {<Year = , Date = , MonthYear = >}

mohsinqlik
Partner - Creator
Partner - Creator
Author

Yes i am making selection in current year .

This is my set analysis

above

(

Count

(

{

<

Year={$(=(max(Year)))}

>

}

)ID)

6,0)

sunny_talwar

Try this:

If(Count({<Year={$(=(max(Year)))}>}ID) > 0, Above(Count({<Year = >}ID), 6,0))

mohsinqlik
Partner - Creator
Partner - Creator
Author

I have tried that but still jul-dec values are not coming from previous year