cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
derekma19
Frequent Visitor

Line Chart with two lines with different values and dates using a unique X axis

Hi, I'm trying to display 2 lines of values based on different dates. The data is as shown as below.

 

StartDateEndDateStartValueEndValue
01 Jan 202115 Jan 202156
01 May 202125 Jun 20211521
01 Aug 202101 Sep20212426

 

now I want to put in the same line chart both lines. However, if I use StartDate in the X Axis, the EndValue won't be correctly displayed and the same will happend with the Start Value.  For example, in the image below the 01/Sep/2021 it is displaying 24 and 26 when it should be only 26. Image below for reference.

 

I'm getting this

derekma19_0-1669371199641.png

 

and I want to get something like this 

 

derekma19_3-1669371562756.png

 

I believe I need a DateTable from the dates I am interested in and make a relationship with my dates table but I've tried relationship with Start and End Date and It doesn't work.

 

Any idea is more than welcome

 

Thanks!

 

 

 

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @derekma19 

If you have a calendar table, you can try add another inactive relationship between ‘Table’[EndDate] and 'Calendar'[Date].

veasonfmsft_0-1669706668041.png

 

Then put 'Calendar'[Date]  to the x-axis of line chart , and put the following two measure to the y-axis of line chart.

M_startvalue = SUM('Table'[StartValue])
M_EndValue = CALCULATE(SUM('Table'[EndValue]),USERELATIONSHIP('Table'[EndDate],'Calendar'[Date]))

veasonfmsft_1-1669706815993.png

 

USERELATIONSHIP 

Please check attached pbix for more details.

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @derekma19 

If you have a calendar table, you can try add another inactive relationship between ‘Table’[EndDate] and 'Calendar'[Date].

veasonfmsft_0-1669706668041.png

 

Then put 'Calendar'[Date]  to the x-axis of line chart , and put the following two measure to the y-axis of line chart.

M_startvalue = SUM('Table'[StartValue])
M_EndValue = CALCULATE(SUM('Table'[EndValue]),USERELATIONSHIP('Table'[EndDate],'Calendar'[Date]))

veasonfmsft_1-1669706815993.png

 

USERELATIONSHIP 

Please check attached pbix for more details.

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Vote for T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors