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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Frequent Visitor

Overlay timeseries (difft time res/ranges; 2-column tables) on a line chart using "Secondary y-axis"

Power BI novice just getting started.

My goal here seems to me like it should be simple but I'm finding it's not.

If the answers to my questions are posted elsewhere, or there are sections of the documentation and/or blogs you think I would benefit from reading, please provide links.


I have two 2-column (timestamp, value) data tables. Each has datetimes in the first column and values (one file has temperature the other has oxygen; different units and ranges) in the second column. 


The two datetime columns have different temporal resolutions and time period ranges.


I can plot the two time series individually using separate line charts:


(I adjusted the x-axis range of the top plot to match the one in the lower plot)


Q1: To do the above, I had to deselect the default "Date hierarchy" checkmark from the x-axis field (timestamps). Why?


Q2: (Related to Q1?) I see that Power BI insists that, even with a two-column file for which I just want to do a simple line plot, some form of aggregation is applied (SUM). (And it labels the plot "Sum of ...", though I just want to plot the individual points without an aggregation, for now.) What should I read, in order to better understand why that is the default (and/or how to turn it off, if that's possible)?


So far the data model is just two independent tables: 



Now my main goal is to overlay the two time series on the same single line chart, using “Secondary y-axis”. 


Q3: What is the simplest way to do this? Can it be done without changing the data model? Or must an new relationship be made between the tables, and/or some third calendar table?


When I try naively adding the other variable into the Secondary y-axis field of one of the existing plots, that variable appears on the plot, with a right-hand y-axis, as desired—but only one point appears, the SUM (see Q1 & Q2) of all its values.


I also tried adding the second Timestamp field to the x-axis, which is allowed, but clearly that's not enough. 


This was quite a bit harder than I like to admit.  I left my original approach (separate date and time dimension tables) in there but it doesn't work when you use field hierarchies in the x axis - the axis becomes categorical rather than continuous.  Go figure.

View solution in original post

Frequent Visitor

I include at bottom two example data files, in case that's helpful.


It sounds like I should be making a calendar table, adding it to my data model, making some sort of connections to it from my existing two tables, and then putting the calendar table in to the x-axis of the line chart. 



About the calendar table, is it limited to having times that fall on a regular grid? I would really like to avoid that if at all possible. The resolution of one record is 15 minutes, and the resolution of the other record is about 1 hour but somewhat irregular. I need to be able to plot the data at the actual times collected, rather than aligning them to a new grid (e.g. through aggregation to hourly means). 


@lbendlin , thanks for the response. For A1, in fact it was required. If I accepted the default, the data were aggregated to daily means. What I did was to uncheck "Date heirarchy" and check "Timestamp" (this is the name/header of the column of dates in the file). I believe this is what made it so that the sum calculation was done over each individual timestamp, and the individual values appeared on the plot instead of daily averages.


Example data file one: (Example data file two is down below it)

8/23/2023 12:0022.94
8/23/2023 12:1523.68
8/23/2023 12:3023.9
8/23/2023 12:4524.06
8/23/2023 13:0024.66
8/23/2023 13:1525.58
8/23/2023 13:3025.46
8/23/2023 13:4525.24
8/23/2023 14:0024.62
8/23/2023 14:1523.72
8/23/2023 14:3020.02
8/23/2023 14:4513.66
8/23/2023 15:0013.2
8/23/2023 15:1513.14
8/23/2023 15:3013.14
8/23/2023 15:4513.16
8/23/2023 16:0013.16
8/23/2023 16:1513.18
8/23/2023 16:3013.2
8/23/2023 16:4513.2
8/23/2023 17:0013.22
8/23/2023 17:1513.26
8/23/2023 17:3013.28
8/23/2023 17:4513.32
8/23/2023 18:0013.36
8/23/2023 18:1513.42
8/23/2023 18:3013.42
8/23/2023 18:4513.5
8/23/2023 19:0013.64
8/23/2023 19:1513.8
8/23/2023 19:3013.96
8/23/2023 19:4514
8/23/2023 20:0014.1
8/23/2023 20:1514.14
8/23/2023 20:3014.26
8/23/2023 20:4514.42
8/23/2023 21:0014.62
8/23/2023 21:1514.68
8/23/2023 21:3014.68
8/23/2023 21:4514.68
8/23/2023 22:0014.7
8/23/2023 22:1514.7
8/23/2023 22:3014.72
8/23/2023 22:4514.72
8/23/2023 23:0014.74
8/23/2023 23:1514.78
8/23/2023 23:3014.82
8/23/2023 23:4514.54
8/24/2023 0:0014.44
8/24/2023 0:1514.44
8/24/2023 0:3014.12
8/24/2023 0:4513.64
8/24/2023 1:0013.34
8/24/2023 1:1513.36
8/24/2023 1:3013.44
8/24/2023 1:4513.58
8/24/2023 2:0013.72
8/24/2023 2:1513.9
8/24/2023 2:3014.02
8/24/2023 2:4514.06
8/24/2023 3:0014.06
8/24/2023 3:1513.94
8/24/2023 3:3013.54


Example data file two:

8/22/2023 1:028.69
8/22/2023 2:028.7
8/22/2023 3:028.61
8/22/2023 4:028.45
8/22/2023 5:028.37
8/22/2023 6:058.17
8/22/2023 7:027.88
8/22/2023 8:027.84
8/22/2023 9:027.74
8/22/2023 10:027.67
8/22/2023 11:327.47
8/22/2023 12:249.04
8/22/2023 13:027.45
8/22/2023 14:027.32
8/22/2023 15:027.3
8/22/2023 16:027.51
8/22/2023 17:027.66
8/22/2023 18:057.83
8/22/2023 19:028.02
8/22/2023 20:028.45
8/22/2023 21:028.21
8/22/2023 22:028.47
8/22/2023 23:028.49
8/23/2023 1:028.3
8/23/2023 2:028.23
8/23/2023 3:028.3
8/23/2023 4:028.2
8/23/2023 5:028.3
8/23/2023 6:058.27
8/23/2023 7:028.15
8/23/2023 8:027.94
8/23/2023 9:027.86
8/23/2023 10:027.81
8/23/2023 19:028.6
8/23/2023 20:028.78
8/23/2023 21:028.85
8/23/2023 22:028.92
8/23/2023 23:028.9
8/24/2023 0:028.88
8/24/2023 1:028.83
8/24/2023 2:028.8
8/24/2023 3:028.64
8/24/2023 4:028.52
8/24/2023 5:028.47

This was quite a bit harder than I like to admit.  I left my original approach (separate date and time dimension tables) in there but it doesn't work when you use field hierarchies in the x axis - the axis becomes categorical rather than continuous.  Go figure.

Thanks @lbendlin ! Very helpful, to get me started here.


As a test, I deleted the Date and Time tables that you added to the data model, so that it only had the one new Timestamps table. It seems that the visual was not affected by this.


So as I understand it this solution consists of (a) creating a new 1-column table that merges the Timestamp columns of the two input tables; (b) adding 1:* relationships from the new table to the corresponding columns of the two input tables; and (c) then using the new table as the field for the x-axis in the plot. Correct? I learned a lot.


It works. But it is indeed more complicated than I was expecting. If anybody can suggest alternative solutions, please do!


p.s. This is probably a separate topic, but eventually I may want to do this same kind of overlay, with more than 2 time series (i.e. starting from say 3, or maybe 4, of the 2-column input files like the two that I shared here). So I have been looking at xVix Multi-Axes Chart as a possible solution. I wonder if this tool would require the the same kinds of data manipulations as for the two y-axes case described above, or perhaps the underlying data handling would be different.

Thank you @lbendlin . I will review that carefully. I also found this and it seems useful:

There are many reasons for not using auto date/time  (mainly based on storage impact for your data model), and only very few scenarios where it is appropriate (after you scrubbed your data to make sure you don't have any bogus dates like "12/31/9999" )

Super User
Super User

A1: Not required, but highly recommended. What you really want is to disable all Date/Time Auto shenanigans, and to add a proper calendar table to your data model (which would eventually feed your visual's X axis)

A2:Line visuals show numerical values, and thus require an aggregation. This is by design

A3: See A1.

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.