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
wooand
Helper II
Helper II

Last Month's Data

Hi,

 

I've found that I can use the following to identify a rolling prior 1 month period:

 

Present Month Volume = CALCULATE(SUM('Totals'[USD Total Amount]),
DATESBETWEEN('Totals'[Trade Date],
Date(YEAR(EDATE(today(),-1)),MONTH(EDATE(today(),-1)),1),
EOMONTH(today(),-1)))

 

The issue is that my data runs not from today as indicated in the formula, but from a random final date, usually the last day of the prior month.  How should I adapt the formula to deliver the prior month's result?

 

1 ACCEPTED SOLUTION
v-caliao-msft
Microsoft Employee
Microsoft Employee

@wooand,

 

my data runs not from today as indicated in the formula, but from a random final date, usually the last day of the prior month.

What exact result are you expecting? Is the “prior month’s result” refers to the results from “today” subtracting one month? (So the final day is “today”).

As I tested, I have got a trade date column like:
Capture1.PNGCapture2.PNG

Referring to your DAX, the final result becomes (the final day is 2017-12-31)

Capture3.PNG


So I assume it is not the result set you want. (screenshot above)

Hence, as a quick guess, I suggest you replace the

DATESBETWEEN('Totals'[Trade Date],
Date(YEAR(EDATE(today(),-1)),MONTH(EDATE(today(),-1)),1),
EOMONTH(today(),-1)))

With

DATESINPERIOD('Totals'[Trade Date], TODAY(), -1, MONTH)

Then I get result ended up “today()”
Capture4.PNG

 

Regards,

Charlie Liao

View solution in original post

2 REPLIES 2
v-caliao-msft
Microsoft Employee
Microsoft Employee

@wooand,

 

my data runs not from today as indicated in the formula, but from a random final date, usually the last day of the prior month.

What exact result are you expecting? Is the “prior month’s result” refers to the results from “today” subtracting one month? (So the final day is “today”).

As I tested, I have got a trade date column like:
Capture1.PNGCapture2.PNG

Referring to your DAX, the final result becomes (the final day is 2017-12-31)

Capture3.PNG


So I assume it is not the result set you want. (screenshot above)

Hence, as a quick guess, I suggest you replace the

DATESBETWEEN('Totals'[Trade Date],
Date(YEAR(EDATE(today(),-1)),MONTH(EDATE(today(),-1)),1),
EOMONTH(today(),-1)))

With

DATESINPERIOD('Totals'[Trade Date], TODAY(), -1, MONTH)

Then I get result ended up “today()”
Capture4.PNG

 

Regards,

Charlie Liao

Many thanks Charlie, that works.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.