Forum Discussion
Compare Feature Sales with Previous Year Feature Sales
Hi Anonymous,
Its wrong again. Below you will find a picture of a sample that i have done based on my data and show where i want to go:
The correct result is the 2 tables side by side.
How can i merge these 2 tables with a formula so as to not get the wrong result shown in the graph?
Hi asl10
I think I have found a solution for your problem.
The solution is creating a slicer table of Input Dates and do the computation and display.
The steps I did.
1. Created a calendar table as
Calendar = Calendar(Min(Reservations[Reservation Date]),max(Reservations[Reservation Date]))
2. Created a year column in this table as Year = YEAR('Calendar'[Date])
3. Created relationship between Calendar Date and Reservations Date.
4. Created a Summarized Table as
SlicerTable = Summarize(Reservations,Reservations[Input Date])
5. Renamed the Input Date as SlicerInput
6. Created a slicer using SlicerInput.
7. Created a measure SumRevenue = sum([Revenue])
8. Created a measure
FutureValue(Input Date) =
var FutureYear = Year(Values(SlicerTable[SliceInput]) )+1
Return
CALCULATE([SumRevenue],FILTER(Calendar,Calendar[Year]=FutureYear))
9. Created a measure
PastDate = Date( Year (Values(SlicerTable[SliceInput])) - 1, Month(Values(SlicerTable[SliceInput]))
,Day(Values(SlicerTable[SliceInput])))
somehow Dateadd was not giving me the results so had to use the base coding
10. Created a measure
PastValue(Input Date) =
CALCULATE([SumRevenue],
Filter (Reservations,[Input Date] <=[PastDate] )
)
11. That is it.
12. Created a bar graph
It gives the result expected by you.
Couple of doubts I still have is will Reservation Date always point one year ahead of the Input Date ? If not then I need to burn some more calories to derive a wholesome solution.
If this works for you please accept it as a solution and also give KUDOS. I am requesting other members also for the same.
Cheers
CheenuSing