Forum Discussion
rpul
8 years agoFrequent Visitor
DAX functions in CALCULATE
v-sihou-msft I have been trying to carry out a calculation comparing previous years, but whenever I use a DAX function, such as PREVIOUSYEAR, as a filter in CALCULATE nothing gets returned. ...
- 8 years ago
Hi,
In your visual drag the Year from the Calendar Table. Write this measure
=CALCULATE(SUM(sheet1[NUmber of sales]),PREVIOUSYEAR(Calendar[Date]))
rpul
8 years agoFrequent Visitor
Interkoubess thank you for your help.
I created a calendar table (New Table, Calendar = CALENDAR(DATE(2011,1,1), TODAY())) and linked this to my data and still nothing appears. Here is some dummy data where I still do not get any output:
And here is the output when I try to get the previousyear function to run (again using a calendar calculated table or using the date column):
I'd like the new column to be ( , , , 11, 15, 20, 25, 31, 35)
Ashish_Mathur
8 years agoSuper User
Hi,
In your visual drag the Year from the Calendar Table. Write this measure
=CALCULATE(SUM(sheet1[NUmber of sales]),PREVIOUSYEAR(Calendar[Date]))