Forum Discussion

JST15's avatar
JST15
Helper I
1 year ago
Solved

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!!

 

 

 

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

     

    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"}}
    }

7 Replies

Replies have been turned off for this discussion
  • 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-Forum/ba-p/963216

    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/1447523

  • 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

     

     

     

    THANK YOU THANK YOU THANK YOU

    • lbendlin's avatar
      lbendlin
      Super User

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

       

      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"}}
      }
      • JST15's avatar
        JST15
        Helper I

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