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
Cabbage_Baby
Frequent Visitor

Measure Not Working on Line Chart Y-Axis Maximum

Hi Power BI Experts, I could use some help with a DAX and visual interaction issue:

I'm trying to create a dynamic Y-axis maximum for a line chart that responds to different levels of date granularity. Here's the measure I created:

Cabbage_Baby_0-1745387349007.png

 

The intention is to return a different maximum value based on the current date level selected via bookmark navigation (week, month, or year).

Cabbage_Baby_1-1745387394695.png


When I use this measure in a matrix visual, it works perfectly—returning the expected values when switching between date levels using the bookmark navigator.

Cabbage_Baby_2-1745387415618.png

Cabbage_Baby_3-1745387429736.png

Cabbage_Baby_5-1745387489812.png

 

However, when I try to apply this same measure to the Y-axis Maximum range via Conditional Formatting on a line chart, it doesn’t respond at all. The value remains static, regardless of which date granularity is selected.

Cabbage_Baby_6-1745387524503.png

Cabbage_Baby_7-1745387631816.png

Has anyone encountered this before? Is there a limitation with Conditional Formatting on axis properties in charts?


You can download a sample of my power BI report in this link below:

https://drive.google.com/file/d/1PNr_YBySL6FxNSUZMji1lqB23oLzjJw4/view?usp=sharing

Appreciate any insights!

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Cabbage_Baby ,

I recommend using a field parameter for selection of Week/Month/Year rather than bookmarks.

You can then retrieve the selected field parameter within the Max Y-Axis measures.

 

The problem with the bookmark method is that, at the "visual level" where the Max Y-Axis measure is evaluated, ISINSCOPE ( ... ) will always return false because there is no "hierarchy of levels" in that context. The hierarchy levels only exist for measures that are grouped by the axis fields, which is why the measure works in the matrix visual.

 

As an example, I created a field parameter called Date Parameterand edited the calculated table expression slightly:

Date Parameter = 
{
    ( "Week", NAMEOF ( Calendar_Lookup[Start of Week] ), 0 ),
    ( "Month", NAMEOF ( Calendar_Lookup[Start of Month] ), 1 ),
    ( "Year", NAMEOF ( Calendar_Lookup[Start of Year] ), 2 )
}

Then updated Max Y-Axis to:

Max Y-Axis = 
VAR SelectedDateParameter =
    IF (
        COUNTROWS ( 'Date Parameter' ) = 1,
        SELECTCOLUMNS ( 'Date Parameter', 'Date Parameter'[Date Parameter] )
    )
RETURN
    SWITCH (
        SelectedDateParameter,
        "Week", 10,
        "Month", 20,
        "Year", 30
    )

Note that we cannot directly write SELECTEDVALUE ( 'Date Parameter'[Date Parameter] )

(see here).

 

Finally, replaced the bookmark navigator with a slicer on 'Date Parameter'[Date Parameter].

 

I also recommend disabling Auto date/time.

 

PBIX attached.

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

4 REPLIES 4
v-sgandrathi
Community Support
Community Support

Hi @Cabbage_Baby,

 

Thankyou @OwenAuger for your reply on the issue.

I'm glad to hear that your query was resolved! If the response provided by the community member addressed your concern, kindly confirm.

Marking it as Accept Answer and give us Kudos if you found it helpful allows us to ensure that the solutions shared are valuable for the entire community.

 

If you have any further questions, feel free to reach out!
Thank you for your cooperation!

Hi @Cabbage_Baby,

 

May I ask if you have gotten this issue resolved?

If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

 

Thank you.

Hi @Cabbage_Baby,

 

I wanted to check in your situation regarding the issue. Have you resolved it? If you have, please consider marking the reply as Accepted solution and give Kudos that helped you. It would be greatly appreciated by others in the community who may have the same question.

 

Thank you.

OwenAuger
Super User
Super User

Hi @Cabbage_Baby ,

I recommend using a field parameter for selection of Week/Month/Year rather than bookmarks.

You can then retrieve the selected field parameter within the Max Y-Axis measures.

 

The problem with the bookmark method is that, at the "visual level" where the Max Y-Axis measure is evaluated, ISINSCOPE ( ... ) will always return false because there is no "hierarchy of levels" in that context. The hierarchy levels only exist for measures that are grouped by the axis fields, which is why the measure works in the matrix visual.

 

As an example, I created a field parameter called Date Parameterand edited the calculated table expression slightly:

Date Parameter = 
{
    ( "Week", NAMEOF ( Calendar_Lookup[Start of Week] ), 0 ),
    ( "Month", NAMEOF ( Calendar_Lookup[Start of Month] ), 1 ),
    ( "Year", NAMEOF ( Calendar_Lookup[Start of Year] ), 2 )
}

Then updated Max Y-Axis to:

Max Y-Axis = 
VAR SelectedDateParameter =
    IF (
        COUNTROWS ( 'Date Parameter' ) = 1,
        SELECTCOLUMNS ( 'Date Parameter', 'Date Parameter'[Date Parameter] )
    )
RETURN
    SWITCH (
        SelectedDateParameter,
        "Week", 10,
        "Month", 20,
        "Year", 30
    )

Note that we cannot directly write SELECTEDVALUE ( 'Date Parameter'[Date Parameter] )

(see here).

 

Finally, replaced the bookmark navigator with a slicer on 'Date Parameter'[Date Parameter].

 

I also recommend disabling Auto date/time.

 

PBIX attached.

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

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.