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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CarlosOlmos29
Helper I
Helper I

Plot cumulative line up to the last date with data

Hello Power BI community.


I am trying to make a cumulative line chart, but I need that one of the lines does not extend as long as possible, but cut off when I have no more data. I am attaching a graph to give more clarity to the question. In a few words, I need the green line to go until March 31, 2023 and from there the yellow line starts. Thank you very much in advance for your help.

CarlosOlmos29_0-1679931444935.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @CarlosOlmos29 

You can refer to the following example.

I make some change on sample data.

Sample data 

vxinruzhumsft_0-1680592881401.png

 

Measure

Measure = CALCULATE(SUM('Table'[A]),FILTER(ALLSELECTED('Table'),[Date]<=MAX('Table'[Date])&&MAX('Table'[Date])<=DATE(2023,3,31)))

Measure 2 = CALCULATE(SUM('Table'[B]),FILTER(ALLSELECTED('Table'),'Table'[Date]<=MAX('Table'[Date])&&MAX('Table'[Date])>=DATE(2023,3,31)))

Output

vxinruzhumsft_1-1680592965701.png

 

Best Regards!

Yolo Zhu

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

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

The solution would depend upon the data structure.  Share the download link of the PBI file and if possible, please share column/table names in English.  Also, since i see multiple lines in the chart, i am not clear of your expected result.  You may please show the expected result in a Table format.  From there, we should be able to create your desired chart.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi man,

This is the structure of the table I want to show and below is the chart that I would like to achive. In a few words, the lines are cumulatives (green is real, yellow is forecast), so I would like the green line goes until february and since there the yellow line starts (march). 

Thanks in advance for your help. I hope I have made myself clear. 

CarlosOlmos29_3-1680530375889.png

CarlosOlmos29_4-1680530388376.png

 

 

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @CarlosOlmos29 

You can create a measure

e.g 

Measure=IF(OR(SELECTEDVALUE('Table'[Type])="AcumWOSECREAL"&&SELECTEDVALUE('Table'[DATE])<=DATE(2023,3,31),SELECTEDVALUE('Table'[Type])<>"AcumWOSECREAL"),1,0)

Then put the measure to the visual filter

vxinruzhumsft_0-1680072285071.png

Best Regards!

Yolo Zhu

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

 

Hi! Thank you for taking the time to answer me.

This was the measure I created:

Measure = IF(OR(SELECTEDVALUE('Actividad Real CA'[WO Secundaria Real]) = "AcumWOSecReal" && SELECTEDVALUE('Actividad Real CA'[Fecha]) <= DATE(2023,03,31), SELECTEDVALUE('Actividad Real CA'[WO Secundaria Real]) <> "AcumWOSecReal"),1,0) and I got this error:

CarlosOlmos29_0-1680104433382.png

 

Anonymous
Not applicable

Hi @CarlosOlmos29 

Is the [Fecha ]field column  a date type? follow the error prompt above, this [Fecha].The data type may be text, so it cannot be compared with the following 2023/3/31 (numeric column), you need to use the date column to compare with the date 2023/3/31.

 

Best Regards!

Yolo Zhu

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

 

Hi Yolo,

Yes, it is. The Fecha field column is a date type. The other fields are cumulative measures.

CarlosOlmos29_5-1680531006894.png

This is the structure of the table I want to show and below is the chart that I would like to achive. In a few words, the lines are cumulatives (green is real, yellow is forecast), so I would like the green line goes until february and since there the yellow line starts (march). 

Thanks in advance for your help. I hope I have made myself clear. 

CarlosOlmos29_6-1680531086829.png

 

CarlosOlmos29_7-1680531086782.png

 

 

Anonymous
Not applicable

Hi @CarlosOlmos29 

You can refer to the following example.

I make some change on sample data.

Sample data 

vxinruzhumsft_0-1680592881401.png

 

Measure

Measure = CALCULATE(SUM('Table'[A]),FILTER(ALLSELECTED('Table'),[Date]<=MAX('Table'[Date])&&MAX('Table'[Date])<=DATE(2023,3,31)))

Measure 2 = CALCULATE(SUM('Table'[B]),FILTER(ALLSELECTED('Table'),'Table'[Date]<=MAX('Table'[Date])&&MAX('Table'[Date])>=DATE(2023,3,31)))

Output

vxinruzhumsft_1-1680592965701.png

 

Best Regards!

Yolo Zhu

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

It works perfect! Thanks you very much!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.