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

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

Reply
Anonymous
Not applicable

How to create a date measure showing previous month

I have a date table called 'Date Table' with a Date column called [Date]

I want to use this table to create a measure which shows the previous month

 

So, as of today it's December 10 2019 so last month is November 2019. I want this date measure to be dynamic so as soon as it's 1st January I want it to show 'December 2019'

 

Is this possible?

Thanks

Jemma

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Ashish_Mathur  that measure doesn't like the TEXT query - it is red underlined and the error says the syntax is incorrect. See screenshot. However =FORMAT etc seems to work, so I've used this!

 

 

Screenshot.PNG

View solution in original post

11 REPLIES 11
Ashish_Mathur
Super User
Super User

Hi,

So if it is December 11, 2018 today, you want to show the Sales for the period November 1 - 30 2019?  Am i correct?


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

@Ashish_Mathur I'm not looking to display sales, just the month and year value for the previous month. So literally 'November 2019' is what I want the measure to show. 

Hi,

In a card visual, drag this measure

=TEXT(EOMONTH(TODAY(),-1),"mmm-yy")

Hope this helps.


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

@Ashish_Mathur  that measure doesn't like the TEXT query - it is red underlined and the error says the syntax is incorrect. See screenshot. However =FORMAT etc seems to work, so I've used this!

 

 

Screenshot.PNG

v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

If you want to show all dates of previous month on a tbale visual, you could follow steps below:

create measures and add the measure to the viusal level filter,

today = TODAY()

show all dates of previous month = IF(DATEDIFF(MAX('date'[Date]),[today],MONTH)=1,1,0)

Capture5.JPG

Or if you want to show the previous month's value, you could create a measure

previous month's value = CALCULATE(SUM('Table'[value]),FILTER('date',DATEDIFF('date'[Date],[today],MONTH)=1))

Capture6.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @v-juanli-msft I want to show the previous month's value so I tried your second solution however i'm getting May 5496! My date table only goes up to the current date so I have no idea how this happened.

Hi @Anonymous 

As tested, even if i only have date till today, it works on my side, could you provide more information so i can analyze further?

measures

today = TODAY()

Measure = FORMAT(EOMONTH(TODAY(),-1),"mmmm yyyy")

Measure 2 = CALCULATE(SUM('Table'[value]),FILTER('Table',DATEDIFF('Table'[date],[today],MONTH)=1))

Capture10.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

Try

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date Filer]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date Filer],-1,MONTH)))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date Filer],-1,MONTH))))

 

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak  this has something to do with sales and I am looking for a month name....

Tahreem24
Super User
Super User

Youcan use previousmonth dax function to achieve your requirements. Syntax of dax is give below :
Prevoiusmonth(DateTable[Datecolumn])

Please give Kudos and accept this as a solution if it helps you.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Greg_Deckler
Community Champion
Community Champion

See if my Time Intelligence the Hard Way provides a method of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



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...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.