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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

SAMEPERIODLASTYEAR issue

Thank you to all who respond.

My dilema is trying to calcuate revenue by customer only for the previous year.

Using the field "year" in my salesMaster table. 

 

I created a measure called "Revenue LY" = 

CALCULATE(SUM(salesMaster[invoicedRevenue]), SAMEPERIODLASTYEAR('salesMaster'[year].[year])).
 
I also have another measure using in a card to display total only,
 
Diff Between CY LY = SUM(salesMaster[invoicedRevenue]) - [Revenue LY]
 

My problem is just trying to use the year only and not Dates.

 

Any ideas?

Thanks,

BLD

3 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@Anonymous 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-TITHW/m-p/434008



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

What do you mean by  "just trying to use the year only and not Dates"?  For Date and Time Intelligence functions to work well, you must first create a Calendar/Date Table.  Your measure will then be:

Revenue LY = 

CALCULATE(SUM(salesMaster[invoicedRevenue]), SAMEPERIODLASTYEAR('Calendar'[Date]))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;


I created a measure called "Revenue LY" = 

CALCULATE(SUM(salesMaster[invoicedRevenue]), SAMEPERIODLASTYEAR('salesMaster'[year].[year])).

Here ('year') should be deleted,I tested it,when as a plus .year and no .year ,The results are different .

vyalanwumsft_0-1646706377466.png

Or you could try the PARALLELPERIOD .

Measure 2 = CALCULATE(SUM([value]),PARALLELPERIOD('Table'[Date],-1,YEAR))

The final output is shown below:

vyalanwumsft_1-1646706492753.png

If not, can you share a simple example and hope to output the result so that we can better understand your needs?


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;


I created a measure called "Revenue LY" = 

CALCULATE(SUM(salesMaster[invoicedRevenue]), SAMEPERIODLASTYEAR('salesMaster'[year].[year])).

Here ('year') should be deleted,I tested it,when as a plus .year and no .year ,The results are different .

vyalanwumsft_0-1646706377466.png

Or you could try the PARALLELPERIOD .

Measure 2 = CALCULATE(SUM([value]),PARALLELPERIOD('Table'[Date],-1,YEAR))

The final output is shown below:

vyalanwumsft_1-1646706492753.png

If not, can you share a simple example and hope to output the result so that we can better understand your needs?


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

What do you mean by  "just trying to use the year only and not Dates"?  For Date and Time Intelligence functions to work well, you must first create a Calendar/Date Table.  Your measure will then be:

Revenue LY = 

CALCULATE(SUM(salesMaster[invoicedRevenue]), SAMEPERIODLASTYEAR('Calendar'[Date]))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community Champion

@Anonymous 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-TITHW/m-p/434008



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I also tried using 

 

CALCULATE(SUM(salesMaster[invoicedRevenue]), DATEADD(salesMaster[year],-1,YEAR))

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.