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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ldacey
Advocate I
Advocate I

Synchronizing the secondary y-axis with the primary axis

I created a Bar+Line graph with the bar on the primary axis and the line on the secondary axis. 

 

I am displaying the actual metric on the primary y-axis and the forecasted metric on the secondary y-axis. How can I force the secondary axis to be synchronized with the primary?

 

My issue is that when I drill down into a dimension, the actual performance might show a value like 10, but then the forecasted line graph might be at 15 but it would display lower than the actual value. The cause of this is that the secondary y-axis is scaled differently so it throws out any intuition of actual vs forecast that you would get from glancing at the chart.

31 REPLIES 31
Pfoster
Helper I
Helper I

Hello all, better to show up a party late then never... I have had that issue yesterday, and my solution is following:

Pfoster_0-1754637959770.png

The aim is to synchronize both y-axis. In my example, the columns are showing the actual (IST) figures, the line the budget (BUD) ones. To synchronize, I created a helping measure. This measure should find the Maximum of the values (in my case volumes) per month:

AchsenSynchronisierung = 
MAXX(
    ADDCOLUMNS(
        VALUES(Periodenmaster[Period]),
        "MaxMonat",
            VAR aktPeriode = Periodenmaster[Period]
            VAR ist = CALCULATE(
               SUM('Mengen 2025'[Wert]),
                'Mengen 2025'[Periode] = aktPeriode
            )
           VAR bud = CALCULATE(
                SUM('Mengen BUD 25'[Wert]),
                'Mengen BUD 25'[Periode] = aktPeriode
            )
           RETURN MAX(ist, bud)
   ),
    [MaxMonat]
)

 In Periodenmaster[Period], there is the month (as number - 1 = January, 2 = February ...). In 'Mengen xxx'[Wert], I have my volumes. 
Now, this measure is looking, which value is the maximum. Having it, I go into the visual options, and define the maximum of the y-axis (and same way for the 2nd y-axis):

Pfoster_1-1754638620218.png

Pfoster_2-1754638638454.png

 here, I use a formular as maximum, and choose the value of the helping measure. 
In my tests, this workaround works well, and is synchronizing the both axis, even the one or the other has the higher specific value. 
I hope, this helps. 

 

 

 

stan-field
Advocate I
Advocate I

This really should be simpler and faster to accomplish. Same values aligned on both the primary and secondary Y-axis, so you can compare values. You can't lock in min/max values, and you can't use zero/auto or zero/max values because it is unusable when you filter the dashboard to much smaller numbers.

Hey Microsoft, please fix this!

JoaoMNM
New Member

Hi,

 

Instead of setting a Secondary y-axis, since you want to only use the first one, you only need to add the second y series to the same Y-axis cell.

 

Kind regards,

JoãoMNM

KevinGeddert
New Member

I managed to solve this, but I would still like to suggest that a better solution would be for microsoft to prioritze syncing axis the way Tableau does with one button push.

 

The Problem:

In my case I was attempting to sync a bar chart with a sum of actual values, to a sum of budgets; this was done monthly for a year. So each month you would have an actuals bar, and a budget line that needed to match axis. As a default the two were not aligned. Forcing a data range would fix the initial view, but made cross filtering by groups or GL codes ineffective. Conditional formatting by actuals for both primary and secondary axis would syncornize the two axis but at 1/12 the scale necessary for a calendar chart.

 

My solution:

You can force the two Y-axis to sync by conditionally formatting them to the same measure. So I created a "Range Set" measure with the sole purpose of correctly managing the Y-axis. I chose to set my range based on actuals so I needed to calculate the maximum monthly actual which can be accomplished with:

 
Range Set Actual = MAXX(VALUES('Date'[Date]),[Actual])
 
By setting the conditional formatting to 0 for Minimum and this measure for both the Y and secondary Y axis I was able to get them to match. This does however set your maximum value to exactly the top of your highest value. To create a little more appealing whitespace I added a 20% buffer like this:
 
Range Set Actual = 1.2*MAXX(VALUES('Date'[Date]),[Actual])

 

dmuller
Advocate I
Advocate I

This seems to stump a lot of people, but the solution is actually really simple. 
Make sure your Secondary Axis values are turned off, switch on the Align Zeros and make sure your min and max ranges are set to Auto. 

You will notice, that if you display the values of the Secondary Axis, the line will move to the logic of those values. But if you leave it switched off and aligned, it will automatically align itself to the primary Y Axis every time. 

dmuller_0-1721876000363.png

 

Aligning zero's is one thing, but when your secondary axis is quite a ways off from your Y Axis, PowerBI doesnt align the top end either. What this does is creates a graph where the bottom end by 0 is correct, but incorrectly displays the gap between your secondary and the top end of the Y axis.

In this test data, the orange dotted line is a goal. That goal can be dynamic but in this case, its static from month to month. That said, the goal is 925. But because the total proposals for each month are so low, it makes it appear as though they are really close to the goal when in reality, they are not.

AnthonyH_0-1730126235376.png


This is what it looks like when i synchronize both Axis with the same min and max. Which is great if your data is always between that but if it were to go out of those bounds, now I need something custom and dynamic.

AnthonyH_1-1730126294302.png

 

Just pointing this out because the intention of Syncing up 0's is to get close to what Im showing below, but all it does is make sure both graphs start and 0 and not some higher number. In most cases, it will help. But soon as you have a big gap, it starts to lose its effectiveness.

I wish PowerBI had a 1-click feature to align min-max in a dynamic way.

 

For Secondary y-axis, set Minimum/Maximum to "Auto" and turn off "Values".  Then only one axis used for both measures.

isaacsa_0-1730127043250.png

 

 

Thank you @dmuller ! This solved my issue! 😁
Just heads up for the rest, the zoom slider has to be off for both axis.

Anonymous
Not applicable

Set the minimum and maximum range for both Y and secondary-Y axis to be the same.  

This is the only sane way I found! Thanks

isaacsa
Advocate I
Advocate I

Go to > Format Visuals > Visual > Secondary y-axis >  Turn "On" Values > Then Turn "Off" Values

This only hides the values, it does not synchronized them. At first glance it work, but if you compare the values...

This is ridiculous - this issue needs to be fixed!  This function is a single click in Tableau.

what...what is this sorcery?

mrlutton
Advocate II
Advocate II

There is no option to "Align Zeroes" as far as I can tell in the most recent version of PBI. What am I missing? IWhy is syncrhonizing a seconday y axis so difficult?

HimanshuDutt
New Member

Go To >>Format>>Visuals>>secondary Y -axis (ensure it is on)>> Align Zeros -- this must be on.

This synchronizes the bottom of both lines, but not the top. 

One possible solution is the following, but it doesn't work proplery. 

 

Go To >>Format>>Visuals>>secondary Y -axis (ensure it is on)>> Range >> Maximum >> 'fx' >> Look for the maximum of your graph and choose.

Ebby
New Member

Reviving again because I found this thread looking for a similar solution.  The visual now has a function option for the maximum point of the Y-Axis, so I created a measure that was the Peak value (with filters) for the selected data and set the maximum point of both the primary and secondary to that Peak value measure and this solved the issue for me.  Now the axis is adaptable to the context filters, is always the same on both line and column, and always has space for the max possible entry. 

This is a way to go. You evaluate it doing something like:

MaxAxis =

MAXX(

    SUMMARIZE (

        TableContainingXAxisValues,

        TableContainingXAxisValues[XAxisValues],

        "MeasureForMax", MeasureWhichShoudDefineMaximum

    ),

    [MeasureForMax]

)
Then you go to Y-Axis format, select a formula for Maximum and pick measure MaxAxis. Same can be done for Minumum value. Repeat for the secondary Axis and the task to sync the axes is solved. This way your Max evaluation is fully dynamic and your external filter context is preserved.

There is no function peak value with filters for the selected data which automatically change the axis automatically synronized for both axis. please eloborate further.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors