Forum Discussion
jausting
8 years agoFrequent Visitor
12 Month Sales
Hi I have created a measure to sum sales over past 12 months, before August 2017 I want the measure to calculate the previous 12 month sales from a date that is selected in a slicer (Dates Ta...
v-chuncz-msft
8 years agoCommunity Support
You may add FILTER Function to the formula.
https://www.sqlbi.com/articles/filter-arguments-in-calculate/
jausting
8 years agoFrequent Visitor
Hi,
Apologies for the delay in responding. Filter was the solution, just wasnt sure how to use it.
This was my solution for the sales over 12 months, I had a slicer to select the end period
var curDateStr = CALCULATE ( MIN ( Dates2[FilterDate] ), ALLEXCEPT ( Dates2, Dates2[FilterDate] ) )
var curDate = DATE(LEFT(curDateStr,4),VALUE(MID(curDateStr,6,2)),RIGHT(curDateStr,1))
VAR DateAddAlternative = EDATE(curDate,-MonthsToLookBack)
return
CALCULATE ( SUM ( 'EOM_STK'[SOH] ), FILTER(EOM_STK,
EOM_STK[perioddate]=curDate
))