Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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:
The intention is to return a different maximum value based on the current date level selected via bookmark navigation (week, month, or year).
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.
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.
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!
Solved! Go to Solution.
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 Parameter
and 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
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.
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 Parameter
and 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
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |