The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.