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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
aileenkaz
Frequent Visitor

Dynamic Y-axis range in Line chart

Hello!

I have four line charts shown next to each other. They contain the same data F_merged[Value] but there us a filter used on each of them.

I need to have the same Y-axis range for all four charts. If all of them are showing values less than 50, the range should go from 0 to 50. If at least one of them is showing value greater than 50, ranges for all four charts should go from 0 to 100.

 

I am using measure to set the Maximum for Y-axis (based on find the highest value among those plotted in the chart:

F_YMax = IF(MAX(F_merged[Value]) = 0, 50, IF(CEILING(MAX(F_merged[Value]),10)<60,CEILING(MAX(F_merged[Value]),50),100))
(yes, it probably could be written more simply, but nevermind, this works - it changes between 50 and 100 accordingly)
 
However, even if F_YMax is 100, there are some cases when the range of Y-axis is not changed to 0-100.
Can anyone explain why is this happening?
 
Thanks a lot!
 
screenshot.JPG
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @aileenkaz , hello parry2k, thank you for your prompt reply!

 

Please try the following measure:

ValueMeasure = MAX('Table'[Value])

 

F_YMax = 
 IF(
        MAXX(ALL('Table'), 'Table'[ValueMeasure]) = 0, 
        50, 
        IF(
            CEILING(MAXX(ALL('Table'), 'Table'[ValueMeasure]), 10) < 60, 
            CEILING(MAXX(ALL('Table'), 'Table'[ValueMeasure]), 50), 
            100
        )
    )

 

 Result:

vyajiewanmsft_2-1739329162700.png

 

 

vyajiewanmsft_1-1739328893479.png

 

Best regards,

Joyce

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

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @aileenkaz , hello parry2k, thank you for your prompt reply!

 

Please try the following measure:

ValueMeasure = MAX('Table'[Value])

 

F_YMax = 
 IF(
        MAXX(ALL('Table'), 'Table'[ValueMeasure]) = 0, 
        50, 
        IF(
            CEILING(MAXX(ALL('Table'), 'Table'[ValueMeasure]), 10) < 60, 
            CEILING(MAXX(ALL('Table'), 'Table'[ValueMeasure]), 50), 
            100
        )
    )

 

 Result:

vyajiewanmsft_2-1739329162700.png

 

 

vyajiewanmsft_1-1739328893479.png

 

Best regards,

Joyce

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

parry2k
Super User
Super User

@aileenkaz that makes sense. Let me ask you this. Do all these visuals have filters from the common tables? What does the data model look like? Can you share a sample pbix file?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@aileenkaz yes that is the reason, let's test changing ALLSELECTED to ALL and go from there.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

If I use ALL, F_YMax is always 100 (even if all plotted values in the four graphs are less than 50).

parry2k
Super User
Super User

@aileenkaz hard to tell but try this:

 

F_YMax = I
VAR __Max = CALCULATE ( MAX(F_merged[Value]), ALLSELECTED () )
RETURN
IF ( __Max = 0, 50, 
    IF ( CEILING (__Max, 10 ) < 60, CEILING ( __Max, 50 ), 100 )
)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I tried, but the result is the same 😞

It seems the value of F_YMax is calculated for each graph separately.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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