Forum Discussion
mykolasg
4 years agoNew Member
Max date in selected week
Hello i have the following data. Final purpose is to select week and get Balance of that weeks max date. Looking forward to suggestions. Date Week Number Vendor Balance 2022-01-03 1...
- Anonymous4 years ago
Hi mykolasg ,
I think you want to calculate the date of max balance in select week. You can try this code.
Max Date select week = VAR _SELECT_WEEK = SELECTEDVALUE ( 'Dim Week Number'[Week Number] ) VAR _MAX_Balance = CALCULATE ( MAX ( 'Table'[Balance] ), FILTER ( ALL ( 'Table' ), 'Table'[Week Number] = _SELECT_WEEK ) ) VAR _MAX_Date = CALCULATE ( MAX ( 'Table'[Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Week Number] = _SELECT_WEEK && 'Table'[Balance] = _MAX_Balance ) ) RETURN _MAX_DateResult is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Hi mykolasg ,
I think you want to calculate the date of max balance in select week. You can try this code.
Max Date select week =
VAR _SELECT_WEEK =
SELECTEDVALUE ( 'Dim Week Number'[Week Number] )
VAR _MAX_Balance =
CALCULATE (
MAX ( 'Table'[Balance] ),
FILTER ( ALL ( 'Table' ), 'Table'[Week Number] = _SELECT_WEEK )
)
VAR _MAX_Date =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER (
ALL ( 'Table' ),
'Table'[Week Number] = _SELECT_WEEK
&& 'Table'[Balance] = _MAX_Balance
)
)
RETURN
_MAX_Date
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.