Forum Discussion
Help comparing two different periods using SAMEPERIOD()
Hi,
The Year and Quarter columns should be in the Calendar Table. To your visual/slicer/filters, drag any date dimenion such as year, month, quarter from the Calendar Table. Revised your measures to:
1) Total Atributes = sum('database'[Valor])
2) Total Atributes LY = calculate(Total Atributes, sameperiodlastyear(Calendar[Date]))
3) % Diference = divide([total atributes] - [total atributes LY],[total atributes LY])
Hope this helps.
Hi Ashish! Thank you for your reply.
I understood what you meant, I've tried it and couldn't make it work because if I drag the date dimension I wouldn't be able to use my Text columns. I tried to make a new column in my calendar with the text quarters/years and still couldn't do it.
But your post helped me see that the solution was good, I've made a duplicate of my database and left one of them with just the Full Year values/dates and another one with the quarters. This way I was able to sum the quarters and not have a full year + 4Q in my 4Q visual.
I had to divide things into two visuals for now, one with the comparisons between years and another one with quarters, but I will look for a way to integrate them into a single table/visual that changes if we want to see years or quarters.
So thank you very much!
- Ashish_Mathur4 years ago
Super User
You are welcome.