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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.


@ 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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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