Forum Discussion
manar_alamri
Helper I
1 year agoAdd Previous QTD-YTD-MTD-Yesterday data
Hello, I am trying to add new column to compare the data with the previous data based on the filter the filter contains (QTD-YTD-MTD-Yesterday) options how I can make the prev - net sales co...
Anonymous
1 year agoNot applicable
Hi all,thanks for the quick reply, I'll add more.
Hi manar_alamri ,
Try this
Measure =
VAR _timeFrame = SELECTEDVALUE('yourtable'[Time Frame])
RETURN
SWITCH(TRUE(),
_timeFrame = "Yesterday",CALCULATE([Net Sales],'FactTable'[Date] = TODAY()-1),
_timeFrame = "MTD",CALCULATE([Net Sales],DATESMTD('FactTable'[Date])),
_timeFrame = "ATD",CALCULATE([Net Sales],DATESQTD('FactTable'[Date])),
_timeFrame = "ytd",CALCULATE([Net Sales],DATESYTD('FactTable'[Date]))
)
Best Regards