cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
giuliapiazza94
Helper IV
Helper IV

Problem with Previousmonth

Hi guys,

I need the dates of the previous month but using a different date than the current one for example the date of the last reload (5/3/2021)

I try using 

Month last reload = CALCULATE(PREVIOUSMONTH('Diagnostica'[Last reload]), MONTH('Diagnostica'[Last reload])-1)

Diagnostica is a table with 1 column and 1 row where is the date of the last reload.

It doesn't work. Can you help me please?

2 REPLIES 2
amitchandak
Super User
Super User

@giuliapiazza94 , in case you want to create a table then

 

table of last month =

calendar(eomonth(today(),-2)+1,eomonth(today(),-1))

 

if you need to measure use time intelligence with a date table 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

I've tried 

table of last month =

calendar(eomonth(today(),-2)+1,eomonth(today(),-1)) 

but doesn't work. 

The error is MdxScript(model) (14,28)

 

do you know why?😥

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show episode 9

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors