Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I would like to compare time periods Jan 2019 – July 2019 with Jan 2020 – July 2020 in a barchart. How to get that organised in the dimensions. See attachment for details
That should be beacuse you alredy have 2 dimensions, ie: the year dimension.
You can remove this year dimension toa loow more expressions.
Or if you want dymanic years you can create a Month field and use:
Sum({<Month={"<=7"}>} [Total Cost])
You can create the month is script with: Right(YearMonth, 2)
Hi, you can have a variable to store the max date to compare, like:
SET vMaxDate_CY = =Date(Floor(MonthEnd(AddMonths(Today(),-1))));
And another for last year:
SET vMaxDate_LY = =Date(AddYears(Floor(MonthEnd(AddMonths(Today(),-1))), -1));
And use this variables in set analysis:
Sum({<Date_Field={">=$(=YearStart('$(vMaxDate_CY)'))<=$(vMaxDate_CY)"}>} [Total Cost])
Sum({<Date_Field={">=$(=YearStart('$(vMaxDate_LY)'))<=$(vMaxDate_LY)"}>} [Total Cost])
Hi @rubenmarin ,
Thanks! A few additional questions:
Hi @Kirsten
If you want fixed periods for each expression it can be easier, you dot need anything of above, just use this expressions:
2020: Sum({<YearMonth={">=202001<=202007"}>} [Total Cost])
2019: Sum({<YearMonth={">=201901<=201907"}>} [Total Cost]))
Ah thanks @rubenmarin . these last 2 expressions do what I need. Although it seems a bit impossible to have both one bar for jan-july 2020 and one bar for jan-july 2019 in one graph. I can only add one measure
These are the expressions used
Sum({<YearMonth={">=201901<=201907"}>} [Total Cost])
Sum({<YearMonth={">=202001<=202007"}>} [Total Cost])
See attachement
That should be beacuse you alredy have 2 dimensions, ie: the year dimension.
You can remove this year dimension toa loow more expressions.
Or if you want dymanic years you can create a Month field and use:
Sum({<Month={"<=7"}>} [Total Cost])
You can create the month is script with: Right(YearMonth, 2)
Yes now it works as expected 🙂 Thanks!