Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
datadonuts
Advocate II
Advocate II

Following the ITALIANS, but wrong RUNNING TOTAL with TOTALYTD

I just followed a video from Alberto "Showing actuals and forecasts in the same chart with Power BI" (https://youtu.be/DKgF-5QHY68) as well their blog here -> https://www.sqlbi.com/articles/showing-actuals-and-forecasts-in-the-same-chart-with-power-bi/

 

I replicated successfully the example and wanted bring it a step further to my example.

Unfortunately I got stuck computing the RUNNING TOTAL.

 

First what I want to do: In month 5 (May) the last sales were made on e.g. May 15. In this case I want to show the Budget value instead of Sales. From there I want to show only the budget value from June to December. This also as a running total.

 

Screenshot 2021-01-05 205001.jpg

 

I achieve that with 

 

RB2 Remaining Budget =
VAR RB_lastsalesdate = CALCULATE(MAX(Orders1[OrderDate]), REMOVEFILTERS(Dates))
VAR RB_datecheck = IF(RB_lastsalesdate <= ENDOFMONTH(Dates[Date]), 1, 0)
VAR RB_budgetafter = IF(
RB_datecheck = 0,
[Total Sales],
[Total Budget adjusted]
)
RETURN
RB_budgetafter
 
Success. Here we go!

Screenshot 2021-01-05 205646.jpg

 

 

 

 

 

 

 

 

So far so good. This gives me a column that shows the TotalSales from Jan to April followed by the Budget from May to December.

 

Now calculation the RUNNING TOTAL (RB2 cumulated) using TOTALYTD, as described in their blog. Unfortunatey I got a wrong result. The number 423,768 in 2008-5 is the sum of the budget from 1 - 5. From 2008-6 to 2008-12 it adds up the budget number as required, but on the wrong basis number from 2008-5; so actually the running total is wrongly calculated from June to December.

 

Screenshot 2021-01-05 211325.jpg

The columns "Testing", "last sales date all" and "last date month" are just for understanding.

 

I was not able to figure out, where the problem is neither to find a replacement for the TOTALYTD running total calculation.

I guess, it can only achieved it with a "virtual table" holding the figures of the column "Remaining Budget" and then compute a running total.

 

Ideas are hightly appreciated.

 

Note: the sales granularity is on the dat while the Budget is monthly.

 

Screenshot 2021-01-05 214039.jpg

 

<iframe width="600" height="373.5" src="https://app.powerbi.com/view?r=eyJrIjoiNzY2MDBlNGYtZWQzZC00M...

 

 

 

 

 

 

1 REPLY 1
lbendlin
Super User
Super User

RB2 cumulated should be computable as a SUMX() of RB2 Remaining Budget.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.