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
jayPBI23
Helper I
Helper I

year over year Sales Calculation not working

I have two tables. One Premium and One Dates. Here is the relationship: PaymentDate(Premium) and Date(Dates), it's a many to one relationship. 

 

jayPBI23_1-1656948666087.png

I'm trying to calculate Year over Year Sales. Here is my formula so far, 

 

Total Sales Last Year = CALCULATE(SUM(Premium[TotalCollected]), SAMEPERIODLASTYEAR(Dates[Date]))
 
The current result so far, 
jayPBI23_2-1656948883595.png

 

What am I missing here? It's throwing back same numbers as the current year. Any help is much appreciated!

 

1 ACCEPTED SOLUTION

Hi,

Thank you for your feedback.

Please kindly advise the below.

- Is the number correct?

- I simply used your calculatd column formula to create a measure. I did not change anything except your formula is for a calculated column and mine is for a measure. If your requirement is not to show the future dates information, please add some conditions into the measure. Please check the attached file that I amended the measure not to show the future date's information. 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

7 REPLIES 7
Jihwan_Kim
Super User
Super User

Hi,

Please try, "assign your Dates Table as date table".

Hover over the mouse on your Dates Table's name, and right click. And then you can find a function called "Make as date table".

 

Set and use date tables in Power BI Desktop - Power BI | Microsoft Docs

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Hey!

 

So I did do that. It is marked as date table with "date" field being the date column. 

May I ask what are your columns'  data type?

If possible, please share your pbix file's link here, and then I can try to look into it to come up with a more accurate solution.

Thanks.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


here is a link to the pbix file, https://www.dropbox.com/s/zego0j370awlxoo/YearOVerYearTest.pbix?dl=0

 

I've cleaned the data up so it has only what you need. 

 

Thanks!

Hi,

Thank you for your message and please check the attached file.

I created a measure, instead of calculated column.

Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


When I open up your file, it looks like its throwing the total collected numbers to future dates:

jayPBI23_0-1657053256218.png

 

Hi,

Thank you for your feedback.

Please kindly advise the below.

- Is the number correct?

- I simply used your calculatd column formula to create a measure. I did not change anything except your formula is for a calculated column and mine is for a measure. If your requirement is not to show the future dates information, please add some conditions into the measure. Please check the attached file that I amended the measure not to show the future date's information. 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.

Top Solution Authors