Last Period Sales and Drill Up/Down

I have a visual with date hierarchy year-quarter-month as x-axis and y-axis as sales. I am able to calculate last period sale using Calculate and DATEADD functions. How to write a dax so that when users drill down or up it automatically becomes last month/last quarter?

To get a solid answer please add more detail. Check out the link just above your question for tips on how to get the best support from those monitoring the forum and assisting other members.