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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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