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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Nanakwame
Helper II
Helper II

Time Intelligence YTD and Previous year calculation.

Hi Experts,

 

I am creating a power bi sales dashboard with KPI's showing previous year sales, year to date sales and Variance indicating positive or negative. I will like the KPI to be time intelligence to only use same period as last year. For instance if the year to date KPI is showing $50,000 then last year sales should only calculate up to October 22 of last year. 

 

Any dax function that can help with this?

 

Thank you

5 REPLIES 5
Greg_Deckler
Super User
Super User

@Nanakwame You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

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

 

If you have a custom fiscal calendar TI functions are useless.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
goncalogeraldes
Super User
Super User

Hello there @Nanakwame ! You can either use the SAMEPERIODLASTYEAR() or the PARALLELPERIOD() with the same formulas that are your current measures. You can check the following documentation on these two formulas:

 

https://docs.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

https://docs.microsoft.com/en-us/dax/parallelperiod-function-dax

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

This is what  have for sales PYTD 

SalesPYTD = CALCULATE([SalesYTD],SAMEPERIODLASTYEAR('Date'[Date]))
It doesnt work for this formula 

@Nanakwame I'll give you a few examples:

SalesPYTD = CALCULATE([SalesYTD],SAMEPERIODLASTYEAR('Date'[Date].[Date]))

SalesPYTD = CALCULATE([SalesYTD],DATEADD('Date'[Date], -1, year))

or alternatively:

SalesPY = CALCULATE([Sales], SAMEPERIODLASTYEAR('Date'[Date].[Date]))
SalesPYTD = TOTALYTD([SalesPY], 'Date'[Date].[Date])

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

Hi @goncalogeraldes 

 

I have the same dax function but it appears to be showing the full year previous sales instead of the same period. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors