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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
datadonuts
Helper II
Helper 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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors