Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
t_hylander
Creator
Creator

custom timeframe on a bar chart

I've now tried a couple of variants on how to show a barchart with a timeline X +/- 3months but cant get it right.

I found something here that I use in a textbox for test purpose;


$(=Month(max(TestDate))-3)


and that works, but how do I apply this as a calculated dimension in my bar chart??

a example;

By selecting "June" my bar chart should show march, april, may, JUNE, july, aug, sep.

Thanks in advance!

3 Replies
hdonald
Creator
Creator

Hi,

How about picking the latest 7 months by Rank in your calculated dimension ? - assuming you have an unbroken sequence of months you might use a Year Month field in the format YYYYMM,

=IF( Aggr( rank("Year and Month") ,"Year and Month" )<=7,'Year and Month" )

Regards,

HD

hdonald
Creator
Creator

....or are you after a dynamic selection of months in that 7 month span shown in your example ?.

e.g. if you created a Slider / Calendar object based on 'Year and Month' and ticked the Multi Value mode, the user could click and drag to create a 7 month (or whatever) span of months and them slide that across however many years you display in the slider timeline ?

Is that the effect you're after ? (there's a good 'Year and Quarter' slider example in the Online Sales.qvw)

Regards,

HD

Not applicable

instead of using bar chart why don't you use a straight table then use this in your expression:

sum({<MonthNum={$(=MonthNum-3)}>} SC_SALES)

sum({<MonthNum={$(=MonthNum-2)}>} SC_SALES)

sum({<MonthNum={$(=MonthNum-1)}>} SC_SALES)

_______________________________________________

sum({<MonthNum={$(=MonthNum)}>} SC_SALES) -> selected month

_______________________________________________

sum({<MonthNum={$(=MonthNum+1)}>} SC_SALES)

sum({<MonthNum={$(=MonthNum+2)}>} SC_SALES)

sum({<MonthNum={$(=MonthNum+3)}>} SC_SALES)



hide the dimension so that the selected month is not shown twice..