Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 | Amazon | 1000 |
2022-01-04 | 1 | Amazon | 95 |
2022-01-05 | 1 | Amazon | 400 |
2022-01-06 | 1 | Amazon | 900 |
2022-01-07 | 1 | Amazon | 1500 |
2022-01-08 | 1 | Amazon | 1999 |
2022-01-09 | 1 | Amazon | 10000 |
2022-01-10 | 2 | Amazon | 1000 |
2022-01-11 | 2 | Amazon | 95 |
2022-01-12 | 2 | Amazon | 400 |
2022-01-13 | 2 | Amazon | 900 |
2022-01-14 | 2 | Amazon | 1500 |
2022-01-15 | 2 | Amazon | 1999 |
2022-01-16 | 2 | Amazon | 10000 |
Solved! Go to Solution.
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.
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.
Hi,
I am not sure how your desired outcome visualization looks like, but please check the below picture and the attached pbix file.
Max date balance: =
LASTNONBLANKVALUE ( Data[Date], SUM ( Data[Balance] ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
@mykolasg , Try like
calculate(lastnonblankvalue(Table[Date], sum(Table[Balance])))
Use allexcept if needed
User | Count |
---|---|
57 | |
22 | |
18 | |
16 | |
11 |
User | Count |
---|---|
85 | |
54 | |
39 | |
21 | |
18 |