Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
How do I compare the same dates in different years on a line chart? I would like to display two lines, one for 2020 and one for 2021 for comparison, not one line as in the attached screenshot.
Thanks,
/Staffan
be sure you don't have any selection
dimension =DAY(Date)
measure
=Sum({<Date = {">=$(=Max(Addyears(YearStart(Date),-1))) <=$(=Max(Addyears(YearEnd(Date),-1)))"} >} Visits)
=Sum({<Date = {">=$(=Max(YearStart(Date))) <=$(=Max(Yearend(Date)))"} >} Visits)
Hi Staffan,
Put this in the dimension:
Month( Date.autoCalendar.Date )
Year( Date.autoCalendar.Date )
You need two different dimensions for this.
Put this in the measure:
Sum( Visits )
Jordy
Climber
you can create two measure :
sum({YEAR="$(=Max(YEAR))"}>}Visits) for the year
sum({YEAR="$(=Max(YEAR)-1)"}>}Visits) for the year-1
and the month in dimension
Thanks,
However, this results in a single line showing 2020 to 2021. I would like to display two lines comparing day to day of april (the dataset only contains data from april 2020 and april 2021).
My goal is something like this (but single days on x-axis instead of years):
Thanks Taoufiq,
However, I get the following error when using the first measure:
=Sum({<YEAR = {"$(=Max(YEAR))"} >} Visits)
=Sum({<YEAR = {"$(=Max(YEAR)-1)"} >} Visits)
Thanks, the function works now, but I get the same type of chart as before:
@Staffan can you share a sample data ?
Sure - as you can see, the data set is very simple. Just Date and Visits for april 2020 and april 2021:
@Staffan if I understood correctly
you have or you add in script Day(Date) as DAY and year(Date) as YEAR
in the UI
dimension DAY
measures:
1->=Sum({<YEAR = {"$(=Max(YEAR))"} >} Visits)
2->=Sum({<YEAR = {"$(=Max(YEAR)-1)"} >} Visits)