Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi everyone, I am trying to reference a line charts maximum value in a second measure for a different visual.
Is my line chart, the x-axis is date, and the y-axis is a measure that calculates actual occupancy of a hotel. (The measure is simply a distinct count of all reservations and its assigned room).
I need to write a measure that will look at all the dates we're filtering for, and determine what the maximum value. The problem I'm running into is that MAX has to reference a column, not a measure; and MAXX is returning a value greater than the peak on the line chart.
Solved! Go to Solution.
In that case try this:
Max Actual Occupancy =
CALCULATE (
MAXX(
DISTINCT('Calendar'[Date]),
[Actual Occupancy]),
ALLSELECTED ('Calendar'))
Proud to be a Super User!
Hi, @MPetramalo214
Let suppose you measure in visual is [HotelOccupancy].
Create new measure like:
MaxHotelOccupancy =
VAR MaxDate = MAX('Datetable'[Date])
RETURN
CALCULATE([HotelOccupancy],
FILTER(ALL('Datetable'),
'Datetable'[Date] = MaxDate ))
Proud to be a Super User!
Max Actual Occupancy =
var maxDate = MAX('Calendar'[Date])
return
CALCULATE(
[Actual Occupancy],
'Calendar'[Date] = maxDate
)
I tried the above measure, and its returning the same value as actual occupancy for each day
In that case try this:
Max Actual Occupancy =
CALCULATE (
MAXX(
DISTINCT('Calendar'[Date]),
[Actual Occupancy]),
ALLSELECTED ('Calendar'))
Proud to be a Super User!
Very cool! Works perfectly as intended - I was also able to accomplish this with another measure
var __table = SUMMARIZE('Calendar','Calendar'[Date], "_-value", _Measures[Actual Occupancy])
return MAXX(__table, [_-value])
but your solution works in the exact format I needed it to!
Thanks again!
I remeber that use can use also analytics tab in line chart options to set max sales line.
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/
Proud to be a Super User!
User | Count |
---|---|
98 | |
75 | |
69 | |
49 | |
26 |