Forum Discussion
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%.
| StartDate | EndDate | Return_A | Ret_Y | Period |
| 2023-12-31 | 2024-01-01 | 1% | 1.00% | YTD |
| 2023-12-31 | 2024-01-02 | 1.01% | 1.01% | YTD |
| 2023-12-31 | 2024-01-03 | 1.02% | 1.02% | YTD |
| 2023-12-31 | 2024-01-04 | 1.03% | 1.03% | YTD |
| 2023-12-31 | 2024-01-05 | 1.04% | 1.04% | YTD |
| 2023-12-31 | 2024-01-06 | 1.05% | 1.05% | YTD |
| 2023-12-31 | 2024-01-07 | 1.06% | 1.06% | YTD |
| 2023-12-31 | 2024-01-08 | 1.07% | 1.07% | YTD |
| 2023-12-31 | 2024-01-09 | 1.08% | 1.08% | YTD |
| 2023-12-31 | 2024-01-10 | 1.09% | 1.09% | YTD |
| 2023-12-31 | 2024-01-11 | 1.10% | 1.11% | YTD |
| 2023-12-31 | 2024-01-12 | 1.12% | 1.12% | YTD |
| 2023-12-31 | 2024-01-13 | 1.13% | 1.13% | YTD |
| 2023-12-31 | 2024-01-14 | 1.14% | 1.14% | YTD |
| 2023-12-31 | 2024-01-15 | 1.15% | 1.15% | YTD |
8 Replies
- DataDadaNew Member
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
- SafdarHussainNew 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 - Ashish_MathurSuper 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.
- v-karpurapudCommunity 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! - v-karpurapudCommunity 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-karpurapudCommunity 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!