Forum Discussion

barathrk's avatar
barathrk
Frequent Visitor
1 year ago
Solved

Multi line plot from multiple tables with no relation

Hi, I am a beginner user of Power BI. I want some help plotting a multi-line graph from multiple tables. For example, I have the following table. Voltage Current Time Temperature 1 Temperat...
  • grazitti_sapna's avatar
    1 year ago

    Hi barathrk 
    In Power BI Desktop, you can plot a multi-line graph from multiple tables dynamically by following these steps:

    Step 1: Combine Your Data into a Single Table

    Since you have 10 tables with the same structure, the best approach is to combine them into a single table to make visualization easier.

    Method 1: Using Power Query (Recommended)

    1. Go to Power Query Editor

      • Click on Transform Data in Power BI Desktop.
    2. Append Queries

      • Load all 10 tables into Power Query.
      • Select any one of the tables and go to Home > Append Queries > Append Queries as New.
      • Add all 10 tables into the append operation.
      • Click OK → This will create a single table with all your data.
    3. Add a "Source Table" Column (Optional but Recommended)

      • If you need to distinguish which row comes from which table, add a custom column that stores the table name.
    4. Close & Apply

      • Click Close & Apply to load the combined data into Power BI.

    Step 2: Create a Multi-Line Graph

    Now that all data is in a single table:

    1. Go to Report View and insert a Line Chart.
    2. Drag and Drop Fields
      • X-Axis: Choose the desired column (e.g., Capacity or Current).
      • Y-Axis: Choose the desired column (e.g., Voltage).
      • Legend: Use the “Source Table” column (if added) to differentiate the lines.
    3. Enable Dynamic Selection of X and Y Axes
      • Create a Disconnected Table with all column names (Capacity, Voltage, Current, etc.).
      • Use Switch Measures to allow users to select X and Y dynamically via slicers.

    Step 3: Add Slicers for Interactivity

    • Add a Slicer to let users filter out specific tables.
    • Add Slicers for dynamic X and Y selection.

    Notes:

     

    • No coding required.
    • Dynamic selection of X and Y axes.

     

     

    🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
    💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
    🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
    🔗 Curious to explore more? [Discover here].
    Let’s keep building smarter solutions together!

  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the reply from grazitti_sapna and MFelix, please allow me to add some more information.

    Hi barathrk ,

     

    I tested grazitti_sapna's solution and it might meet your needs.
    Below is the testing process.

     

    In the Power Query editor, add a custom column for each table to identify the source table of the data.
    This way, after merging all tables, you can easily filter the data of specific tables by this custom column.

     

    Create a field parameter table using the fields from the merged table and create a slicer.
    Later the field parameters can be used as the x-axis to enable dynamic selection of the x-axis.

     

    Create a disconnected table and use it to create a slicer.

    Table = ALL(Parameter[Parameter])

     

    Creates a measure to be used as the Y-axis.

    Measure = 
    SWITCH(MAX('Table'[Parameter]),
    "Capacity",SUM(Append1[Capacity]),
    "Current", SUM(Append1[Current]),
    "Temperature 1", SUM(Append1[Temperature 1]),
    "Temperature 2", SUM(Append1[Temperature 2]),
    "Temperature 3", SUM(Append1[Temperature 3]),
    "Time", SUM(Append1[Time]),
    "Voltage", SUM(Append1[Voltage])
    )

    The measure dynamically displays the corresponding aggregated values based on the selection of the disconnected table slicer.

     

    The final results are as follows. The X and Y axes of the line chart can dynamically change based on the selection of the slicer. It is also possible to filter the tables used in the line chart based on the slicer.

     

    Please see the attached bpix for reference.

     

    Best Regards,
    Dengliang Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.