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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
stackover
Frequent Visitor

Combining running totals with selected date value

Hi guys. How are you doing? It has been a week that I am trying to do the following. I hope you guys can help me.

 

- I have two running totals. One is a baseline and it should be static (problem number one for me because I am no sure if I can have a static mesuare for a line graph).

stackover_0-1706555097016.png

I would like to create a 3rd line filtered by a slider and doing the following: E.g.

I selected Jul/24 in the slider.
The 3rd will show until Jul/24 the running total for "database" table and then from Aug/24 on, it will continue the sum until the MAX date. This is what it would like to be:

stackover_2-1706555697063.png

You can see that the green line did not follow the dark blue because the selected date is up to jul/24.
These are my tables:

stackover_3-1706555839341.png
These are my running total mesuares:

 

RT-Database = 
VAR MaxDate = MAX ('Date_List'[Date])
VAR Result = 
CALCULATE ( 
    SUM(Project_Database[Value]),
    'Date_List'[Date] <= MaxDate,
    ALL (Date_List)
)
RETURN Result
RT-Baseline = 
VAR MaxDate = MAX ('Date_List'[Date])
VAR Result = 
CALCULATE ( 
    SUM(Project_Baseline[Value]),
    'Date_List'[Date] <= MaxDate,
    ALL (Date_List)
)
RETURN Result

 


So my questions are:
1) I am not sure if a slider com control only a single line. 
2) Creating the measure below is not doing what I would like.

 

RT-Database 2 = 
VAR MaxDate = MAX ('Date_List'[Date])
VAR MinDateDataBase = [SelectedDate]
VAR BaselineRes = 
CALCULATE ( 
    SUM(Project_Database[Value]),
    'Date_List'[Date] <= MinDateDataBase,
    ALL (Date_List)
) +
CALCULATE ( 
    SUM(Project_Baseline[Value]),
    'Date_List'[Date] > MinDateDataBase,
    ALL (Date_List)
)
RETURN BaselineRes

 


Thanks to everyone. 

 

1 ACCEPTED SOLUTION

12 REPLIES 12
stackover
Frequent Visitor

This calculates the accumulated man hour. The baseline is what was initially planned at the beginning of the project. The Database table represents the man hours carried out. When someone selects a date in the slicer, this will be the cutoff date between the realized man-hour and the man-hour forecast represented by the rest of the baseline data.
Then the line would continue to be a running total, in which the realized values would be the sum of the values in the database table plus the forecast (baseline table), which would be the sum of the values from the selected date until the end of the table Baseline.

lbendlin_0-1706633350853.png

 

That is perfect. Thank you very much.

stackover
Frequent Visitor

Thanks @Ibendlin, but I think I am still not able to explain. See if the table can help you to understand my intent.

stackover_0-1706629139481.png
I did the following measure but it is not working. Looks like that the measure is not detecting the selected slicer value.

RT-Combined = 
VAR MaxDate = MAX ('Date_List'[Date])
VAR SelectedSlicerDate = MAX(DateSlider[Date])
VAR Result = 
CALCULATE ( 
    SUM(Project_Database[Value]),
    Date_List[Date] <= SelectedSlicerDate
) +
CALCULATE ( 
    SUM(Project_Baseline[Value]),
    Date_List[Date] > SelectedSlicerDate && 'Date_List'[Date] <= MaxDate
)
RETURN Result



 

Yeah, still nothing.  No idea where you are going with this. Maybe some business context?

lbendlin
Super User
Super User

lbendlin_0-1706626446693.png

 

stackover
Frequent Visitor

Thanks for the file, but unfortunately I think I wasn't clear about what I would like to achieve. The selectable date in the slider is a cutoff date, that is, the running total of the database table goes up to the date selected in the slider and after that the running total continues to add up taking the values from the baseline table.

Would this be possible to do?

Not sure I understand. You said the second screenshot was the expected result.  Please clarify/provide another screenshot.

stackover_0-1706624940059.png

I think in this graph it is possible to see what I am trying to explain. Sorry if I am not able to make it very clear. Note that the total running on the left side of the red vertical line refers to the RT-Database line and after Jul/24 (right side of the red line) the running total will receive the values from the RT-Baseline line.

It is a running total made up of the two tables. Until a selectable date it takes the values from the Database table and after that it continues the total running taking the values from the Baseline table. I hope I was able to explain.

stackover
Frequent Visitor

Thanks. I am uploading my .pbix file for a better understand.

https://we.tl/t-HF4X3Ml2Oe

 

The second screenshot is the expected result.

see attached

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.