Page 125 — Does SUM() work?

A dedicated forum to help people when working through the book "Learn to Write DAX"
Greg Truby
Posts: 1
Joined: Sat Apr 01, 2017 4:40 am

Page 125 — Does SUM() work?

Postby Greg Truby » Sat Apr 01, 2017 4:51 am

Possible error in first paragraph of page 125. Manual YTD formula works for me if I swap out the MAX(...) bit for YEAR and put in MIN(...) or AVERAGE(...). But it does not work if I put in SUM(...). If SUM(...) actually should work then please (pretty please, with sugar on top) explain why. Because I when I read that last sentence in the first paragraph my first reaction was "SUM()?! Really?! :shock: Then I really don't know what's going on here!".

Posts: 791
Joined: Sun May 04, 2014 4:01 pm
Location: Sydney, Australia

Re: Page 125 — Does SUM() work?

Postby MattAllington » Fri Apr 14, 2017 8:24 am

Yes it should work with sum. You have to clear your mind of what these functions were designed to be used for as their main purpose and instead break the problem into pieces. When you use a YTD function, you always have an initial filter context on a single year. This means there is only 1 value for year in the current filter context. It therefore follows if you SUM() that single value, you will return that single value. If you take the AVERAGE() of that single value, you will return that single value. Same with min and max.
Matt Allington is Professional Self Service BI Consultant, Trainer and Author of the book "Learn to Write DAX". You can hire me at

Return to “Help with the Book "Learn to Write DAX"”

Who is online

Users browsing this forum: No registered users and 3 guests