Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |