The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 |
---|---|
80 | |
74 | |
41 | |
30 | |
28 |
User | Count |
---|---|
108 | |
96 | |
53 | |
48 | |
47 |