Forum Discussion
Measure Not Working on Line Chart Y-Axis Maximum
- 1 year ago
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-Axismeasures.The problem with the bookmark method is that, at the "visual level" where the
Max Y-Axismeasure 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
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