Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hello, we are trying to return the Date or the Day (or both) to be used in a Card. We have found the Max Status Value but can't get the calculation to return the corresponding Date or, ideally, the Day (Tuesday).
Here is the measure that returns the maximum value in the table within the [StatusAdj1] measure column.
Test =
VAR MaxUtil = MAXX(ALLSELECTED(FCT_SpaceOccupancyStatusHourQtrPots[Date]),[StatusAdj1])
// VAR Check = [StatusAdj1] = MaxUtil
Return MaxUtil
Ideally, we would like to return a card with the date, in this case it would be 10 May 2022 and another Card with the Day for that Date = Tuesday.
Solved! Go to Solution.
You can create a couple of measures like
Date of Max =
SELECTCOLUMNS (
TOPN (
1,
ALLSELECTED ( FCT_SpaceOccupancyStatusHourQtrPots[Date] ),
[StatusAdj1], DESC,
FCT_SpaceOccupancyStatusHourQtrPots[Date], ASC
),
"@val", FCT_SpaceOccupancyStatusHourQtrPots[Date]
)
Day of Max = FORMAT( [Date of Max], "dddd")
In the event of 2 dates having the same max value this will return the earliest. If you want the latest instead just change ASC to DESC
John, that worked straight out the box.
Thank you.
You can create a couple of measures like
Date of Max =
SELECTCOLUMNS (
TOPN (
1,
ALLSELECTED ( FCT_SpaceOccupancyStatusHourQtrPots[Date] ),
[StatusAdj1], DESC,
FCT_SpaceOccupancyStatusHourQtrPots[Date], ASC
),
"@val", FCT_SpaceOccupancyStatusHourQtrPots[Date]
)
Day of Max = FORMAT( [Date of Max], "dddd")
In the event of 2 dates having the same max value this will return the earliest. If you want the latest instead just change ASC to DESC
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
115 | |
112 | |
105 | |
95 | |
58 |
User | Count |
---|---|
174 | |
147 | |
136 | |
102 | |
82 |