Forum Discussion
Help: Using PREVIOUSYEAR() returns a Blank column...
I am using the following to calculate a goal measure:
goal = calculate(count(FactInternetSales[CustomerKey]),PREVIOUSYEAR(FactInternetSales[OrderDate]))*1.05
But get a blank column. How to deal with it?
The data structure is like the following:
Hi Anonymous ,
To use previous year function, you can create a continuous date table by this measure:
Table = CALENDARAUTO()
Then modify your measure like this:
goal = calculate(count(FactInternetSales[CustomerKey]),PREVIOUSYEAR('Table'[Date]))*1.05
You will get the following result:
Here is the demo , please try it:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- v-yingjlCommunity Support
Hi Anonymous ,
To use previous year function, you can create a continuous date table by this measure:
Table = CALENDARAUTO()
Then modify your measure like this:
goal = calculate(count(FactInternetSales[CustomerKey]),PREVIOUSYEAR('Table'[Date]))*1.05
You will get the following result:
Here is the demo , please try it:
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hey Anonymous
Try using SAMEPERIODLASTYEAR instead: https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax
Not sure what your data looks like, but I think all you need is to change out PREVIOUSYEAR with SAMEPERIODLASTYEAR
If this helps, pelase kudo
If this solves your problem please accept it as a solution.
- AnonymousNot applicable
I know how to use SAMEPERIODLASTYEAR instead; but I want to know how to use PREVIOUSYEAR?