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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
reendzz98
Helper I
Helper I

Display previous month

Hi there. I need help to display previous month based on the data that I have. Below is the months that I have:

reendzz98_0-1667579920332.png

I get to display current month using measure max(Month). I tried to find measures through website but the one that I could find either to display sales on the current month or to display previous month based on real-time date. 

I want a measure that allows the powerBi to display 'August' and automatically displays 'September' when 'October' data comes in.

 

2 REPLIES 2
reendzz98
Helper I
Helper I

Hi @v-yalanwu-msft , thank you for your respond. I understand from your solution that it will display the value based on previous month, which is very helpful. I actually want to display the previous month only for example, the one that I have now allows to display the current month based on that I have in my table which is September.

reendzz98_0-1667790794726.png

I want to be able to display the previous month which will allow it to display 'August' in the scorecard. Is that possible?

 

v-yalanwu-msft
Community Support
Community Support

Hi, @reendzz98 ;

First you can create a date column for the month, if you have one, you don't need to create another one, if not, create a new date column for the month: similar to the following:

vyalanwumsft_0-1667789726230.png

Then could try to create a measure to calculate the previous month's value:

Previous = CALCULATE(SUM('Table'[value]),PREVIOUSMONTH('Table'[Date]),ALL('Table'))

Or 

Previous2 = CALCULATE(SUM('Table'[value]),DATEADD('Table'[Date],-1,MONTH),ALL('Table'))

Or 

Previous3 = CALCULATE(SUM('Table'[value]),FILTER(ALLSELECTED('Table'),EOMONTH([Date],0)=EOMONTH(MAX('Table'[Date]),-1)))

The final show:

vyalanwumsft_1-1667789972152.png


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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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