Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Based on my selection of a certain date, I would like my chart to display a sum of a field for that date, and another expression displaying the sum of another field for the day before my current selection.
Exapmle: I select the date 12/3/2010, one expression sums for 12/3/2010 and the other for 12/2/2010
I am using set anlysis which I am new to using. Here is my code that does not work:
sum( {$<Date = {$(#=Only(Date)-1)}>} Sales )
Any help is much appreciated
thanks,
alex
You have the right idea. But when you subtract, it's probably going to replace your date with its numeric equivalent. I believe the $(#=...) tells it to do the same thing. Set analysis needs the text version of the date, so you'll need to reformat using date(), get rid of the #, and put it all in single quotes. Finally, your first $ is optional and I usually omit it to avoid confusion with dollar sign expansion. So I'm guessing this:
sum({<Date={'$(=date(only(Date)-1))'}>} Sales)
I'd also typically use max() instead of only() so that I get SOME value, even when they haven't selected anything.
I tried this yet I still get no output on my graph. I'm usind the date field as my dimension, could this have something to do with it??
I appreciate your help John.
Yes, the date field as a dimension might mess that up. Assuming only one date is selected, how about removing Date as a dimension, and using only(Date) as an expression? What sort of chart are you using, and how do you want it to look?
Its a bar chart with 2 expressions (the ones i mentioned in my original post) and the date field as a dimension. All I want is to be able to select a date and have one column show the sum of a field for that date and the other column to show the sum of a field for the day before the date selected.
Can anyone help with this??
Thanks in advance.
Hey hi,
try using variables: vSelectedDate=date(max(Sampledate))
and use it in the expressions