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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
m9820441
Frequent Visitor

Help on measure to get total of last day of last month

Hello, 

 

This is my first post, I read already a lot, but still fighting with measure. 

Situation : 

I have a table with aggregated values per day. 

2020-12-31   5

2022-01-01   10

2022-01-02   50

.

2022-01-31  100

2022-02-28   150

2022-03-31   180

 

What I need is a graph that shows the difference of each last day of the month compared with the last day of month before

So it should return

2022-01-31   95   (difference between 2021-12-31 and 2022-01-31)

2022-02-28   50   (difference between 2022-01-31 and 2022-02-28)

 

I tried with dateadd but I'm now able to find. also parallelperiod is giving me too much as I'm not interested in the sum of all values of last month, but ony value of last day of last month . 

Anyhow, solution is probably simple but I'm a bit stuck ... 

2 REPLIES 2
Greg_Deckler
Super User
Super User

@m9820441 Use EOMONTH( <some date>, -1) function to return the end of the previous month's date.


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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg, thx for your help already. 

I know the function, and seems I have all the pieces but I'd like some more guidance : 

This is what I tried : 

 

ValueMonth-1 =
 CALCULATE(sum(ONU[count]), FILTER(DateTable,DateTable[Date] = eomonth(DateTable[Date],-1)))
 
What I try to do is ge the sum of last day of last month next to the value of current month
 
So 
date                sum                                   sum(eomonth -1)                                               Diff
2022-01-31   <sum(ONU[count])>          <sum(ONU[count])> (2021-12-31)                   <col2> - < col1>

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.