Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
okusai3000
Helper IV
Helper IV

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!!

 

 

 

1 ACCEPTED SOLUTION
LivioLanzo
Solution Sage
Solution Sage

@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 correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

5 REPLIES 5
v-cherch-msft
Employee
Employee

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.

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)

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.
Greg_Deckler
Super User
Super User

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...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
LivioLanzo
Solution Sage
Solution Sage

@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 correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.