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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

[Measure1 by Date1] and [Measure2 by Date2] on the same line chart

Hi there

 

I have trade data: mass, departure date and arrival date. I can plot exports mass by departure time (exports) and mass vs arrival date (imports) on separate charts, but I need to plot them on the same chart so that I can compare them easily. Effectively I want to plot two things on the same chart: (1) Imports by Arrival and (2) Exports by Departure. When I put them together on the same chart, one of them looks good but the other one looks very small (which that is depends on the order of the time variables I put on the axis: departure then arrival, or arrival then departure). Pictures are below and sample data too. Does anyone know how to overcome this?

 

Thanks!

 

Need to plot Exports by Departure, and Imports by Arrival, on the same chartNeed to plot Exports by Departure, and Imports by Arrival, on the same chart

 

 

MassDeparture (UTC)Arrival (UTC)
69360.7219 Aug 2018 05:43:2529 Aug 2018 22:05:53
72032.4015 Aug 2018 15:52:4728 Aug 2018 01:55:13
77132.5413 Aug 2018 06:34:1325 Aug 2018 05:11:12
80747.5910 Aug 2018 04:56:3421 Aug 2018 00:09:04
67683.4508 Aug 2018 01:15:0724 Aug 2018 21:57:07
63708.3903 Aug 2018 04:03:5318 Aug 2018 02:03:12
78192.1001 Aug 2018 03:03:3811 Aug 2018 22:24:25
81134.5028 Jul 2018 13:22:1406 Aug 2018 23:30:05
73741.5024 Jul 2018 13:54:2703 Aug 2018 01:03:27
77804.0421 Jul 2018 10:09:4705 Aug 2018 23:54:41
66500.0918 Jul 2018 05:43:2031 Jul 2018 03:36:01
78608.7315 Jul 2018 09:58:0726 Jul 2018 10:03:03
66411.1312 Jul 2018 06:10:1526 Jul 2018 03:00:45
79039.0010 Jul 2018 11:23:3421 Jul 2018 05:05:15
73400.7206 Jul 2018 14:06:0517 Jul 2018 02:41:37
 06 Jul 2018 14:06:0517 Jul 2018 02:41:37
78192.1004 Jul 2018 19:48:1116 Jul 2018 00:07:00
78856.5801 Jul 2018 22:09:4812 Jul 2018 02:24:57
70240.1826 Jun 2018 20:15:0105 Jul 2018 23:00:48
78123.0725 Jun 2018 18:02:4807 Jul 2018 03:45:54
77591.0021 Jun 2018 21:28:2302 Jul 2018 22:49:53
80161.5018 Jun 2018 05:52:4930 Jun 2018 00:49:18
67358.5015 Jun 2018 21:09:5630 Jun 2018 23:00:26
78429.0611 Jun 2018 21:51:4723 Jun 2018 00:09:55
78345.4308 Jun 2018 05:42:4518 Jun 2018 01:54:13
66031.0003 Jun 2018 22:39:1721 Jun 2018 01:51:28
76804.0001 Jun 2018 05:17:3611 Jun 2018 07:03:00
80148.0029 May 2018 04:22:5506 Jun 2018 22:58:52
77931.6326 May 2018 01:43:0007 Jun 2018 23:59:01
76704.0023 May 2018 01:56:3402 Jun 2018 01:30:05
65953.0019 May 2018 17:09:1903 Jun 2018 02:06:04
78429.0616 May 2018 21:29:5030 May 2018 22:28:20
76570.9512 May 2018 22:00:3923 May 2018 03:41:31
73760.2511 May 2018 13:23:0422 May 2018 06:05:00
76856.0007 May 2018 05:22:0917 May 2018 22:44:39
78160.0004 May 2018 06:36:4424 May 2018 08:34:52

 

 

Exports (10d MAv) = calculate(sum(Sheet1[Mass]),DATESINPERIOD(Sheet1[Departure (UTC)],LASTDATE(Sheet1[Departure (UTC)]),-10,DAY))*365.25/12/10

Imports (10d MAv) = calculate(sum(Sheet1[Mass]),DATESINPERIOD(Sheet1[Arrival (UTC)],LASTDATE(Sheet1[Arrival (UTC)]),-10,DAY))*365.25/12/10

 

 

1 ACCEPTED SOLUTION
3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

Please follow the steps below.

 

1. Firstly , you should create an index column in Query Editor.

 

2. Then try the formula below to create the detail table and create the relationship between with the original table.

 

 

Detail = 
VAR temp =
    SELECTCOLUMNS (
        'Sheet1',
        "Index", [Index],
        "StartDate", [Departure],
        "EndDate", [Arrival]
    )
VAR vCalendar =
    CALENDAR ( MINX ( temp, [StartDate] ), MAXX ( temp, [EndDate] ) )
RETURN
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( temp, vCalendar ),
            [StartDate] <= [Date]
                && [EndDate] >= [Date]
        ),
        "Index", [Index],
        "StartDate", [StartDate],
        "EndDate", [EndDate],
        "Detail", [Date]
    )

3. Then you could create the line chart with the Detail column as shared Axis and the two measure you created as values.

 

Capture.PNG

 

 

More details, you could refer to the attachment.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-piga-msft

Thank you for your response! I have been looking at your solution and trying to learn from it. Observing your results, it does not seem to do what I would like because the green/red lines on the combined chart are different to the green/red lines on the individual charts. What I would like is to superimpose the green/red lines on one chart without changing them... let me know if you have other ideas please

Anonymous
Not applicable

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.