Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

I want to use an expression as a dimension for a line chart

Hi Guys,

I want to use an expression as a dimension for a line chart, I got variables set as Current month to Previous 12 months, how do I use all of them so I wouldn't have to change them every month, that they will be dramatic.

Cheers

23 Replies
Anonymous
Not applicable
Author

No, it needs to be a line chart so they can see the trend.  At the moment, I'm bringing in 25 months worth of data, in my charts, I only want to show the last 12 months.

Gysbert_Wassenaar

Then use a field with the month values as dimension.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Do I create another table with a where clause for 12 months or is there another way where I can limit it to just the last 12 months. 

Gysbert_Wassenaar

You can use a set analysis expression to limit the results to the last 12 months.

Sum({<MyDateField={'>=$(=MonthStart(Today(),-12))<=$)=MonthStart(Today(),-1)))'>}>}Amount)


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

I'm getting no values.

Gysbert_Wassenaar

post your app


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

I can't I'm using qs server.

I think the problem may be, my date field is 201511, 201512, 201601 and it doesn't recognise the months.

Gysbert_Wassenaar

Very likely. Unless that field is a dual valued field it is useless. 201601 - 1 = 201600, which won't be a value in your data. You need either a date field so you can use MonthStart or AddMonths or a consequetively numbered month number field that also increases values by one across year borders. You may want to create the necessary field in the script.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Just say this is the dummy data for six months, six months is loaded in, but I only want to see the last three months on the charts.

   

DATE SALESSALES
2015078494
201507434
201508244
2015083453
20150833333
2015095677
20150932343
20151023334
2015103234
2015112424
2015117567
201512445
201512356
2015124333
2016015677
2016014456

   

DATE SALESSALES
2015078494
201507434
1508244
2015083453
20150833333
2015095677
20150932343
20151023334
2015103234
2015112424
2015117567
201512445
201512356
2015124333
2016015677
2016014456
Anonymous
Not applicable
Author

Dual valued as in 2016 being year and 01 being month? is this possible?  and will it then be recognisable as a date?