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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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