cancel
Showing results for
Did you mean:
Helper V

## Calculate YTD prior month numbers

I am trying to calculate YTD Prior month spend but something is off

This is the dax measure I am using

---YTD Spend PM = CALCULATE([YTD SPEND],DATEADD('Calendar'[Date],-1,MONTH))---

When I break it down by month the grand total shows the correct prior month spend which is 1580500 but it deletes the month of January and attributes the wrong YTD spend number for July. When I exclude the month then it appears that YTD spend is = YTD prior month spend which is not true.

YTD Prior month spend should be 1580500. What Dax measure can I write to show this?

The chart on the left shows correct YTD numbers, the chart on the right was my attempt to calculate the YTD prior month numbers

1 ACCEPTED SOLUTION
Community Support

Hi @dw700d ,

Create a relationship between your date table and fact table to use time-intelligence-function , create measures like this to get the expected result:

``````YTD Spend PM =
CALCULATE ( [YTD Speed], DATEADD ( 'Table'[Date], -1, MONTH ) )``````

Attached sample file that you can refer: Calculate YTD prior month numbers.pbix

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

3 REPLIES 3
Community Support

Hi @dw700d ,

Create a relationship between your date table and fact table to use time-intelligence-function , create measures like this to get the expected result:

``````YTD Spend PM =
CALCULATE ( [YTD Speed], DATEADD ( 'Table'[Date], -1, MONTH ) )``````

Attached sample file that you can refer: Calculate YTD prior month numbers.pbix

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Super User

@dw700d  - I just recently wrote something that might help:

https://community.powerbi.com/t5/Quick-Measures-Gallery/To-bleep-With-TOTALMTD/td-p/1250110

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Learn Power BI 2nd Edition
Super User

Hi @dw700d ,

Regards,

HN

Announcements

#### Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

#### Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

#### What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

#### Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors
Top Kudoed Authors