Reply
Frequent Visitor
Posts: 7
Registered: ‎10-05-2018
Accepted Solution

Measure for Last year sales

Hello everyone,

 

I am getting nuts trying to get a measure from the total sales from last year:

 

Option a) The problem with this one is that is stuck on the current year, so It doesn't change no matter I modify the filter of the year.

 

**Total Sales Last Year = CALCULATE('PalenciaTotales (2)'[**Total Sales];

 

 ('PalenciaTotales (2)'[Año]=YEAR(NOW()-1))

 

option b) Just doesn't work....

 

 

**Total Sales Last Year = CALCULATE('PalenciaTotales (2)'[**Total Sales]; 

 

 ('PalenciaTotales (2)'[Año]-1))

 

 

Also I didn' have any luck with PREVIOUSYEAR formula,

 

Any kind of help is fully appreciated,

 

thanks!!

 

 

 


Accepted Solutions
Super User
Posts: 759
Registered: ‎09-16-2018

Re: Measure for Last year sales

[ Edited ]

@okusai3000

 

If you build a Date dimension table and mark it as Date Table then you can take full advantage of the Time Intelligence formulas in DAX.



Did I answer your question? Mark my post as a solution!


Proud to be a Datanaut!

View solution in original post


All Replies
Super User
Posts: 759
Registered: ‎09-16-2018

Re: Measure for Last year sales

[ Edited ]

@okusai3000

 

If you build a Date dimension table and mark it as Date Table then you can take full advantage of the Time Intelligence formulas in DAX.



Did I answer your question? Mark my post as a solution!


Proud to be a Datanaut!

Super User
Posts: 10,536
Registered: ‎07-11-2015

Re: Measure for Last year sales

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


Community Support Team
Posts: 1,379
Registered: ‎07-25-2018

Re: Measure for Last year sales

Hi @okusai3000

 

It seems you may check your formula PalenciaTotales (2)'[Año]=YEAR(NOW())-1.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor
Posts: 7
Registered: ‎10-05-2018

Re: Measure for Last year sales

Hi Cherie,

 

The problem with NOW function, is that it's not affected by filters. This way, if you select for example, 2005 as main year, it will still be showing you 2017. (2018-1)

Community Support Team
Posts: 1,379
Registered: ‎07-25-2018

Re: Measure for Last year sales

Hi @okusai3000

 

You may use SELECTEDVALUE Function when there is a filter. Sample data and expected output will be helpful to provide an accurate solution.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.