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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DataDada
New Member

Data modelisation - Line Chart

Let's say I have the dataframe below. I want to create a Chart line with it. Y-Axis would the Return_A field. When it comes to X-Axis, I want the user to be able to select the data renge he wants by using fields StartDate and EndDate in 2 different slicers and still having a trend that is diplayed in the chart (Not a single point).

For example, if he choses 2023-12-31 as StartDate and 2024-01-10 as EndDate, logically, the chart will display only the point of intersection (1.09%). That is not what I want: I want to show the trend - all the points prior to 1.09%. 

StartDateEndDateReturn_ARet_YPeriod
2023-12-312024-01-011%1.00%YTD
2023-12-312024-01-021.01%1.01%YTD
2023-12-312024-01-031.02%1.02%YTD
2023-12-312024-01-041.03%1.03%YTD
2023-12-312024-01-051.04%1.04%YTD
2023-12-312024-01-061.05%1.05%YTD
2023-12-312024-01-071.06%1.06%YTD
2023-12-312024-01-081.07%1.07%YTD
2023-12-312024-01-091.08%1.08%YTD
2023-12-312024-01-101.09%1.09%YTD
2023-12-312024-01-111.10%1.11%YTD
2023-12-312024-01-121.12%1.12%YTD
2023-12-312024-01-131.13%1.13%YTD
2023-12-312024-01-141.14%1.14%YTD
2023-12-312024-01-151.15%1.15%YTD

 

8 REPLIES 8
v-karpurapud
Community Support
Community Support

Hi @DataDada 

We have not received a response from you regarding the query and were following up to check if you have found a resolution from the information provided below. If you find the response helpful, please mark it as the accepted solution and provide kudos, as this will help other members with similar queries.

Thank You!

v-karpurapud
Community Support
Community Support

Hi @DataDada 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @DataDada 

We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.

If our response was helpful, please mark it as the accepted solution and give a kudos, as this helps other members in  community.

Thank You!

Ashish_Mathur
Super User
Super User

Hi,

You could try something like this.  In Power Query, select all columns other than the first one, right click and select "Unpivot Other Columns".  Rename Value to Date.  Create a Calendar Table and a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table.  On the X axis, drag Date from the Calendar Table.  Create a date slicer from the Calenar table and select a beg/end date.


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

The most simplest approach to this would be
Creating a line chart with y axis as Return_A and x axis should be End Dates.
Along with this line chart, under that chart - you need a sliding slicer of dates starting from 2023-12-31 and end as 2024-01-15 and then slide according to your requirement and the visual will respect that

MFelix
Super User
Super User

Hi @DataDada ,

 

For this you need to have a disconnected table for date in order to select the start and end. and you should then use the following code:

Measure YTD = CALCULATE(SUM('Table'[Return_A]), 'Table'[EndDate] <= MAX('Calendar'[Date]))

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Thanks Miguel Felix for your quick answer. I tried this way as well using this measure 

Total YTD Tot_Rtn = TOTALYTD(SUM(Data_tst[Ret_X]),Data_tst[EndDate]). It looks as the same thinking. But doiing it this way will agregate the return values, what I don't to since this is compounded return. I want to use the values in the chart as they are right now. This is the issue. Do you have any idea how to do in this case?
 
Thanks again

Hi @DataDada,

 

This depends on how you setup the data you need to add the date has part of the visualization to get the correct value for each data point. 

 

If you want to show a single value then the code need to be different. 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors