Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to compare data current year with previous year.want to see YTD,MTD,QTD in straigh chart.And formulae should be write in Set Analysis.
Please help me to get this.
Thanks in advance,
RuE
Hi Rue,
Assume that we will use the expression to calculate sales.
and that you have modeled the date dimension with each line is represented by a PeriodID, Year, Quarter, Month, Period.
then the Times variables will be as follows :
YTD (Year-To-Date) : Sum({$<PeriodID = {"<=$(=Max(PeriodID))"},Year = {$(=Max(Year))},Quarter = ,Month = ,Period = >} Sales)
QTD (Quarter-To-Date) Sum({$<PeriodID = {"<=$(=Max(PeriodID))"},QuarterID = {$(=Max(QuarterID))},Year = ,Quarter = ,Month = ,Period = >} Sales)
MTD (Month-To-Date) Sum({$<PeriodID = {$(=Max(PeriodID))},Year = ,Quarter = ,Month = ,Period = >} Sales)
Current Year-To-Date versus the same period last year
(Sum({$<PeriodID = {"<=$(=Max(PeriodID))"}, Year ={"$(=Max(Year))"}, Quarter = , Month = , Period = > } [Sales)
/
Sum({$<PeriodID = {"<=$(=Max(PeriodID) - 12)"}, Year ={"$(=Max(Year) - 1)"}, Quarter = , Month = , Period = > } Sales))
-1
the same for Current month versus same month last year or Current month versus previous month, ...
NB:
PeriodID: 201901,201902,201903....
Year:2019
Month:Jan,Feb,Mar,...
Quarter:Q1,Q2,Q3;Q4
Taoufiq
Rue, did Taoufiq's post help you with things? If it did, be sure to circle back to the thread and use the Accept as Solution button on his post to give him credit for the assistance and let other Community Members know this worked for you.
I do have a Design Blog post that may be of some further help too:
https://community.qlik.com/t5/Qlik-Design-Blog/Year-over-Year-Comparisons/ba-p/1462927
If you are still needing assistance, leave an update.
Regards,
Brett