Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Microsoft's running total quick measure, well, it's just not very good. It's overly complex and doesn't work in single table situations. There's a better way as shown in this video: MSHGQM - Don't Use CALCULATE! - YouTube
For reference, Microsoft's running total quick measure generates code such as:
Value running total in Date =
CALCULATE(
SUM('Table'[Value]),
FILTER(
ALLSELECTED('Table'[Date]),
ISONORAFTER('Table'[Date], MAX('Table'[Date]), DESC)
)
)
As shown, this running total doesn't work in single table situations. A better, less complex way to create a running total that works with a single table is like this:
Better RT =
VAR __Date = MAX('Table'[Date])
VAR __Table = FILTER(ALLSELECTED('Table'),[Date] <= __Date)
RETURN
SUMX(__Table,[Value])
And with just a minor change, this method also works if you have a separate Dates table:
Better RT 2 =
VAR __Date = MAX('Dates'[Date])
VAR __Table = FILTER(ALLSELECTED('Table'),[Date] <= __Date)
RETURN
SUMX(__Table,[Value])
Watch the video!
eyJrIjoiMTcxZWJiZmEtZDdiMy00YWYyLWEyOTYtMmI1MDQ4YjlmMTY5IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9
@Greg_Deckler Thank you for this file
I just added one extra column DAY. I placed on page 2 of the attached file. and Total is not correct.
I am facing same error on my main file. Your support will be great.
@Rana_Rumeel See reply in original thread.
Thanks so much! I have been struggling with this measure for what feels like dayssss!
Thanks for sharing the pbix file Greg! I vouch for version Better RT 2, since it's rare for me working in Power BI without a data model.