Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I would like to have both years show up on the same line/bar graph.
Date(Date,'MM/DD') - Right now I get two entries for 01/01, with 2 years of data. That makes sense, but I want to compare the two years, and I would like them be combined.
Any ideas?
Thanks,
Alex
Hi Alex,
You could do it in multiple ways, i'll give you one which i believe is best.
create two variables:
vYearCurrent
=max(Year)
vYearPrevious
=(
if(
GetPossibleCount(Year)=2,
min(Year),
max(Year-1)
)
)
and now you can use these variables in the set analysis with two expressions, one for each year. Something like:
Current Year
sum({< Year= {"$(=vYearCurrent)"}>} Value)
Previous Year
Current Year
sum({< Year= {"$(=vYearPrevious)"}>} Value)
The vYearPrevious is done that way so that when the user want to analyse non-contigous years the graph will remain usefull. If you want it simpler, this variable can be just =max(Year-1).
Hope it helps
Regards,
Carlos
The vYearPrevious variable did not work for me when I used LET. When I used SET, it didn't error but it does not work in my calculation.
Hi,
I think this variables should be created in
Settings Menu -> Variable Overview -> Add
This should not be created in script.
You can also do this without using variables
Current Year
sum({< Year= {'$(=Max(Year))'}>} Value)
Previous Year
sum({< Year= {'$(=Max(Year) - 1)'}>} Value)
Regards,
Jagan.
I think the solution is very simple:
Line chart with 2 dimensions: Year and Month.
Months will supply the 12 values for the X-axes, and Year will cause multiple line series toe be created.
If you have more than 2 Years of data, and you need to limit the scope for the chart, you can also add a Set Analysis condition in your expression to only count last 2 years.
cheers,
Oleg
Hi Oleg,
The issue is that they want to see the data down to the date. Like my example.
And Jagan. I can't exactly do it like that because my client wants to see rolling 12 months in the graph.
Hi,
Create a new field
MonthName(Date) as MonthYear
Then use this set expression.
Sum({<MonthYear = {">=$(=MonthName(addmonths(max(Date),-12)))"}>}FieldName)
Regards,
Kaushik Solanki
OMG
I have spent the whole day playing with set analysis to display various periods on the same X chart, until i saw you very simple solution. Thank you!