0
votes
EVALUATE
FILTER
(
SUMMARIZE (
'Product_Category',
'Product_Category'[id],
'Product_Category'[Sale-Date],
'Product_Category'[Store],
'Product_Category'[Description]
),
'Product_Category'[Acronym] = "Test Product"
)
ORDER BY 'Product_Category'[Sale-Date]

I have the above sample DAX expression to get product sales data. I want to add some sort of a WHERE clause such that only records where the "[Sale-Date]" is in the last 12 months are returned.

I cant seem to figure out how to add that condition, any one please help.

1

1 Answers

0
votes

SQL WHERE is FILTER in Dax. You already are using one filter criteria:

'Product_Category'[Acronym] = "Test Product"

To expand what you have:

EVALUATE
FILTER
(
SUMMARIZE (
'Product_Category',
'Product_Category'[id],
'Product_Category'[Sale-Date],
'Product_Category'[Store],
'Product_Category'[Description]
),

  'Product_Category'[Acronym] = "Test Product" &&
  'Product_Category'[Sale-Date] >= DATE(YEAR(NOW())-1, MONTH(NOW()), DAY(NOW()))

)
ORDER BY 'Product_Category'[Sale-Date]