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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
JST15
Helper I
Helper I

Creating a 3 Axis Line Chart

Hello! In the attached or below, you'll see 3 axis line chart created in excel. It's a line chart using the secondary and then overlapping another line chart on top of that. It works but is a bit sloppy. We're trying to do the same in Power BI without buying a license from a third party. Is there a way to do this using the Power BI native charts? If not, does overlapping two line charts work? Thank you so much for any help!!

3 Axis Line Chart.png 

 

 

1 ACCEPTED SOLUTION

Here's something to get you going.  Still needs coloring, smoothing etc.

 

lbendlin_0-1730638330186.png

The key is the "resolve"  instruction at the bottom.

 

{
  "data": {
    "name": "dataset"
  },
  "encoding": {
        "x": {
          "field": "PERIOD_YEAR",
          "type": "nominal"
        }
  },
  "layer": [
    {
      "mark": {
        "type": "line"
      },
      "encoding": {
        "y": {
          "field": "QTY ",
          "type": "quantitative"
        }
      }
    },
    {
      "mark": {
        "type": "line"
      },
      "encoding": {
        "y": {
          "field": "GM % ",
          "type": "quantitative"
        }
      }
    },
    {
      "mark": {
        "type": "line"
      },
      "encoding": {
        "y": {
          "field": "GM $/unit ",
          "type": "quantitative",
          "axis": {"offset":50}
        }
      }
    }
  ],
  "resolve": {"scale": {"y": "independent"}}
}

View solution in original post

7 REPLIES 7
JST15
Helper I
Helper I

Hi Ibendlin- thank you! I havne't heard of Deneb before, though I'm very new to PBI. Below is the table that the graph is build off of. I hope this is in the correct usable format. I've modified the amounts so none is sensitive information. Ideally, the left y-axis shows both "GM%" and "QTY" each as it's own axis scale with GM% as a percentage and QTY as a number, the right secondary axis shows "ASP$" and "GM $/unit", both in dollar. Picture below. I really hope I've supplied enough information. 

 

PERIOD_YEARQTY GM $/unit GM % ASP $
20191,080$6,950.0041.15%$16,650.00
2020950$7,010.0042.00%$16,680.00
20211,145$6,250.0036.50%$17,500.00
20221,050$5,540.0032.22%$17,200.00
2023970$4,680.0026.50%$17,700.00
2024830$4,840.0027.00%$17,800.00

 

 

3Axis .png

 

THANK YOU THANK YOU THANK YOU

Here's something to get you going.  Still needs coloring, smoothing etc.

 

lbendlin_0-1730638330186.png

The key is the "resolve"  instruction at the bottom.

 

{
  "data": {
    "name": "dataset"
  },
  "encoding": {
        "x": {
          "field": "PERIOD_YEAR",
          "type": "nominal"
        }
  },
  "layer": [
    {
      "mark": {
        "type": "line"
      },
      "encoding": {
        "y": {
          "field": "QTY ",
          "type": "quantitative"
        }
      }
    },
    {
      "mark": {
        "type": "line"
      },
      "encoding": {
        "y": {
          "field": "GM % ",
          "type": "quantitative"
        }
      }
    },
    {
      "mark": {
        "type": "line"
      },
      "encoding": {
        "y": {
          "field": "GM $/unit ",
          "type": "quantitative",
          "axis": {"offset":50}
        }
      }
    }
  ],
  "resolve": {"scale": {"y": "independent"}}
}

Sorry, I'm stuck again. 

 

The intervals ticks for my right side y-axis are using the exact value rather than round whole values intervals like the x-axis. This is causing my the two lines I'm expecting for the right side y-axis to merge into one. I tried changing my formats but it isn't working. I also tried reading the vega light documentation but couldn't figure it out. Do you know how to change this so my right side y-axis uses round whole values rather than the exact? Below is the code I'm using as well. Thank you!!!

 

JST15_0-1730919793709.png

 

 

{
  "data": {"name": "dataset"},
  "encoding": {
        "x": {
          "field": "PERIOD_YEAR",
          "type": "nominal"
          }
  },
"layer": [
    {
      "mark": {
        "type": "line"
      },
      "encoding": {
          "y":{
            "field": "QTY",
            "type": "quantitative"
        }
      }
    },
  {
      "mark": {
        "type": "line"
      },
      "encoding": {
        "y":{
          "field": "GM%_Less LC__formatted",
          "sort":"-y"
        }
      }
    },
{
  "mark": {
    "type": "line"
},
"encoding": {
  "y": {
    "field": "GM $/unit_Less LC__formatted",
    "sort":"-y",
    "axis": {"offset":70}
  }
}
}
],
"resolve": {"scale": {"y":"independent"}}
}

Not sure what your concern is. Do you want to manually provide the values for the tick marks?

 

Axis | Vega-Lite

I'd rather the ticks be even even intervals like 0, 20%, 25%... rather than showing the exact value. I'll read the documents you send as those look like they will help solve the issue. No need to reply and THANK YOU so much for all of the help! This was very appreciated and I learned a ton. 

This is amazing! I've got it working and is great. Thank you for the help and introducing me to Deneb. 

lbendlin
Super User
Super User

Should be simple with Deneb.  Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information. Do not include anything that is unrelated to the issue or question.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors
Top Kudoed Authors