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

I need to compare the totals between the current and previous month

Morning experts,

 

I've got a report which holds totals by month. I've got a data card which shows a specific total, and the user can select either the year to date, or a specific month using a report level slicer and the data card changes accordingly.

 

I want a new measure which finds the previous month's total, and subtracts this from the current month total to see the difference. I can then use conditional formatting to colour the number whther it's a good or bad change. 

To add a complication, I am excluding the number 555 from my measure, as this indicates a 'not applicable' in the column. 

 

I have a formula, which is not working in the slightest:

 

MY MEASURE = CALCULATE(SUM(Database[TOTAL),Database[TOTAL]<>555)-
CALCULATE(SUM(Database[TOTAL]),PREVIOUSMONTH(CalendarYear[Date]),Database[TOTAL]<>555)

 

Any suggestions would be happily tried! 🙂 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

So as I didn't get a response on here I managed to find out that I had to create a measure that calculates the previous month first. 

I did this using :

 

Previous Month Total = CALCULATE(SUM(Database[total]),PREVIOUSMONTH(Database[Date].[Date]))

 

I then simply created a second measure which subtracted the Database[Previous Month Total] from the Database[Total]. Job done! 

 

 

View solution in original post

3 REPLIES 3
PattemManohar
Community Champion
Community Champion

@Anonymous Please provide the sample data which will be really helpful to solve your issue quicker.





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Anonymous
Not applicable

Hi there,

 

Here is a screenshot which shows the data I have - the totals by month and how i've removed the '555' within the visual filter. 

What I want now is a measure that basically does February less January (so 1374-1973), excluding any '555'. 

 
 
 

Screenshot of PBI DesktopScreenshot of PBI Desktop

Anonymous
Not applicable

So as I didn't get a response on here I managed to find out that I had to create a measure that calculates the previous month first. 

I did this using :

 

Previous Month Total = CALCULATE(SUM(Database[total]),PREVIOUSMONTH(Database[Date].[Date]))

 

I then simply created a second measure which subtracted the Database[Previous Month Total] from the Database[Total]. Job done! 

 

 

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.