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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
omegatablets
Frequent Visitor

How to find the peak of a line graph?

Hi there,

 

I have two measurements Cumulative_ActualUnits and Cumulative_RemainingUnits which are displayed as lines in the graph. How do I find the peak of the Cumulative_ActualUnits and the starting value of the Cumulative_RemainingUnits? My end goal is to get the Cumulative_RemainingUnits to start where the Cumulative_ActualUnits end without having the underlying data.

 

Cum_ActualUnits = IF(SUM(Query1[actualunits])=0,BLANK(),CALCULATE(
	SUM('Query1'[actualunits]),
	FILTER(
		ALLSELECTED('Query1'[startdate]),
		ISONORAFTER('Query1'[startdate], MAX('Query1'[startdate]), DESC)
	)
)/CALCULATE (SUM (Query1[plannedunits]), ALL ( Query1), ALLSELECTED (Query1[startdate])))*100

Cum_PlannedUnits = CALCULATE(
SUM('Query1'[plannedunits]),
FILTER(
ALLSELECTED('Query1'[startdate]),
ISONORAFTER('Query1'[startdate], MAX('Query1'[startdate]), DESC)
)
) /CALCULATE (SUM (Query1[plannedunits]), ALLEXCEPT(Query1,Query1[REPORTING_CATEGORY],Query1[UNIT]))*100

 

Cum_RemainingUnits = 
IF(SUM(Query1[actualunits])<>0,blank(),
((CALCULATE(
                SUM('Query1'[remainingunits]),
                FILTER(
                                ALLSELECTED('Query1'[startdate]),
                                ISONORAFTER('Query1'[startdate], MAX('Query1'[startdate]), DESC)
                )
)/CALCULATE (SUM (Query1[actualunits])+sum(Query1[remainingunits]), ALL ( Query1), ALLSELECTED (Query1[startdate])))
+
(CALCULATE (SUM (Query1[actualunits]), ALL ( Query1), ALLSELECTED (Query1[startdate]))/CALCULATE (SUM (Query1[actualunits])+sum(Query1[remainingunits]), ALL ( Query1), ALLSELECTED (Query1[startdate])))) * 100)

 

 

 

 

image.png

15 REPLIES 15
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @omegatablets,

 

It's hard to find something from the formula. Please share a dummy sample. You can upload it to a cloud drive like OneDrive and paste the shared link here. Please mask the confidential data first.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@omegatablets you want to show only remaining units but want to start where actual units end? Is it correct understanding? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k The below picture shows what I am trying to achieve. I want the Cum_RemainingUnits to start where Cum_ActualUnit ends. I want to show both the lines as a continuation.

 

123.png321.png

I know what you are trying to do but still quick quetsion:

 

you want to show both the lines, cummulative remaining units and actual units as two seperate lines and cummlative actual units will continue even there is no data, it will be flat line after that, correcT?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Cumulative actual units will end when there is no more data. There won't be a flat line after that. 

cumm.PNG

 

 

something like this, so it continuous where actual units end.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes, that's what I want but with two lines

cumm.PNG

 

like this?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Yes, But the remaining has to start where the actual ends. 

Sorry, I just realised I hadn't posted the formula for Cumulative Remaining Units but I have added it to the question now.

this?

 

cumm.PNG



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Those two lines should be continuous like this where the red line is the actual units and the green line is remaining units. 123.png

Alright I think I need to udnerstand better what you are looking for?

 

What you mean by two lines?

What is each line? 

 

Seems like I actually didn't get what you are looking for?

 

For sec, just forget powerBI and tell what you are trying to actually do?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

At the very least, is it possible to specify the order in which stacked lines are displayed? ie; How do I specify which lines come on top when overlapping?

Hi Parry, I have posted the formulas for Cum_ RemainingUnits and Cum_ActualUnits in the original post. I have already managed to create a report based off of the two formulas. The only issue I am having is that there is a gap between the lines where Cum_ActualUnits ends and where Cum_ RemainingUnits start. I am trying to get rid of that gap and make it a continuous line

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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