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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

How to take difference of data from first day of last month with first day of previous last month

Hello Friends,

I stuck on some issues calculating the difference between two rows.

I have a running hour of equipment which is always increasing and data saved in excel on daily basis.

I wast BI to calculate the difference from the first day of every month.

asif138_0-1669541868625.png

I want to calculate the yellow highlighted rows.

any one please help me.

Thanks

Asif

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Did the above post solve your problem?

 

Anonymous
Not applicable

or just assume i want to take a difference of each rows, last-previous

MahyarTF
Memorable Member
Memorable Member

Hi,

If I understood correctly, You want to calculate the amount for the first of the month - Amount for the first of the previous month.

For this purpose you could use the below code for creating the measure :

Hoist Diff =
 Var __FistOfMonthVal = CALCULATE(values(Sheet68[hoist]), STARTOFMONTH(Sheet68[Date]))
 Var __PreviousMonthVal = CALCULATE(sum(Sheet68[hoist]), DATEADD( STARTOFMONTH(Sheet68[Date]), -1, MONTH))
 var Result = __FistOfMonthVal - __PreviousMonthVal
 Return Result
MahyarTF_0-1669545498424.png

Appreciate your Kudos and please mark it as a solution if it helps you.

Mahyartf
Jihwan_Kim
Super User
Super User

Hi,

I am not sure about how your datamodel looks like, but if your filter context is Date level, please try using DATEADD DAX function in your measure.

 

DATEADD – DAX Guide

 

 



Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question





Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

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