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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Previous Period Calculation Not Working!

I'm attempting to calculate the previous month's total spent for individual items on a table. The formula I'm currently using to create a new column is:

 

PreviousTotalSpent = CALCULATE(SUM('Item Sales'[Total Spent]),DATEADD('Item Sales'[Date],-1,MONTH))

I've used this formula on a Google Analytics dashboard I created in Power BI and it worked just fine. However, when using it now I'm receiving blank values on my table. I have no idea why this is occuring. I thought maybe it was my column data types that were interfering with the calculation, however when I use SUM on the TotalSpent column, it sums up correctly. DATEADD also works on the date column. It's only when I include both in the calculation formula above that the results do not appear. 

 

Here is what I am seeing:

Power BI Help image.png

 

 

Any idea what is going on? 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

That formula needs to be a measure, not a calculated column formula.


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

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

I also agree with  Ashish_Mathu.

 

Please try with create the measure with that formula then you will get the value.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
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,

 

That formula needs to be a measure, not a calculated column formula.


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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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