Skip to main content

Practical Challenge 5 DAX

Table of Contents

Consider a scenario where the Date table is linked to the Sales table based on the date column, and the Date table includes a “Month Year” column. If I select a specific month, such as Oct-2022, how can I display a trend for the last 12 months, with the axis covering the months from Nov-2021 to Oct-2022? How can I accomplish this?

You cannot achieve this by simply selecting a month from the connected date table. To accomplish this, you need a slicer from an independent or disconnected Date table. You can create a measure as outlined below and then plot it against the “Month Year” column of the connected Date table.

//Date1 is independent Date table, Date is joined with Table  
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -12) +1
return
calculate( sum(sales[Gross Sales]), filter('Date', 'Date'[Date] >=_min && 'Date'[

Add comment