8 Replies Latest reply on Nov 1, 2016 7:09 AM by Sagar Agarwal

# How to get dispaly only last 6 months values?

For whatever measures I just need to get only last 6 month s result.How can we achieve that?Simon RuncSherzodbek Ibragimov

Thanks

• ###### 1. Re: How to get dispaly only last 6 months values?

Hi.

Create a calculation:

Drag on filter card and ser value to true.

1 of 2 people found this helpful
• ###### 2. Re: How to get dispaly only last 6 months values?

Isa

Can you try this:

if( DATEDIFF('month', [Date], [Parameter]) < 6  AND DATEDIFF('month', [Date], [Parameter]) >= 0)

then 1 else 0 end

where you need to create a date parameter and bring it to view as the filter.

also bring above calculated field to filter box and select only 1.

Hope it helps.

Sherzod

4 of 4 people found this helpful
• ###### 3. Re: How to get dispaly only last 6 months values?

...and if you don't want to set the "current date" from a parameter, and your data isn't so up-to-date so you can't use today(), we can use an LoD to pick up the last month in the data and then set the last N months from that (using the filter).

In the attached example, I've created a Month Index column, so last date is month 0, then -1, -2...etc. we can then use this to filter the data.

[Month Index]

DATEDIFF('month',DATETRUNC('month',[Order Date]), {MAX(DATETRUNC('month',[Order Date]))})

*-1

4 of 4 people found this helpful
• ###### 4. Re: How to get dispaly only last 6 months values?

Thanks A lot ..Worked well.Thanks Simon RuncSherzodbek Ibragimov@Luciano Vasconcelos

• ###### 5. Re: How to get dispaly only last 6 months values?

Hi,

Just curious - wouldn't dragging the Date field to the Filters shelf - and then choosing 6 months as filter option do the needful?

I am wondering why we need to go the "Calculated Field" way as suggested solutions here.

Sagar

• ###### 6. Re: How to get dispaly only last 6 months values?

hi Sagar,

I can't speak for Isa's exact requirements, but yes in principle using the "Last N Months" type filter would do the trick, if the data was up to today. When using the "Relative Date Filter" it's always anchored from Today, or a static date. There are ways round this, as this post shows

but this can come unstuck in certain situations (eg. depending on where you are in the week)...so by using a formula you have complete control.

I assume the data isn't alway up-to-today and this is reason Isa wants to use a formula.

1 of 1 people found this helpful
• ###### 7. Re: How to get dispaly only last 6 months values?

Sagar,

In my situation calculation was needed to serve the purpose.And it all worked very well