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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Custom calendar calculate..need value from last month to show in 1st week of this month

Hi,Everyone

 

Really need your help to get me through this...

I'm want to calculate gap from last month vs this month ,

and gap result should show in 1st week of each month...

 

my calendar is fiscal calendar...

from example using "DATEADD" which cause it wrong ,

how can i allocate last month offset to 1st week of each month ?

 

Slide1.JPG

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

i can fix it wiht unprofesstional code below..Capture.JPG

 


Last Month Offset = CALCULATE([This Month Offset],FILTER(ALL('Calendar'),'Calendar'[WDMonthNo]=MAX('Calendar'[WDMonthNo])-1 && 'Calendar'[WeekOfMonth]=MIN('Calendar'[WeekOfMonth])&&'Calendar'[WDYearNo]=SELECTEDVALUE('Calendar'[WDYearNo])))

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@Anonymous 

You can try like with time intelligence and date calendar. But need data for your exact case

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 MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
last year MTD Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

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
Greg_Deckler
Community Champion
Community Champion

Sample data always helps. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

I thought that there was a PREVIOUSMONTH time intelligence function. Also, you can always do time intelligence calculations yourself and skip the hassle, see if my Time Intelligence the Hard Way provides a different way 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...
Anonymous
Not applicable

Thank you Greg & Amitchandak for your help ,Maybe i'm too new to understand the solution but i'm try to learn "earlier" to get the condition to a result i need 🙂

Anonymous
Not applicable

i can fix it wiht unprofesstional code below..Capture.JPG

 


Last Month Offset = CALCULATE([This Month Offset],FILTER(ALL('Calendar'),'Calendar'[WDMonthNo]=MAX('Calendar'[WDMonthNo])-1 && 'Calendar'[WeekOfMonth]=MIN('Calendar'[WeekOfMonth])&&'Calendar'[WDYearNo]=SELECTEDVALUE('Calendar'[WDYearNo])))
Anonymous
Not applicable

Hi @Anonymous,

You have solved the problem by yourself, right?

 

Best Regards

Rena

Anonymous
Not applicable

Yes,Rena . i solved it by myself.

Anonymous
Not applicable

Hi @Anonymous ,

Thanks for your reply. Could you please mark your last post as solution? It may help others if they face the similar problem. Thank you.

 

Best Regards

Rena

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors