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.
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
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 |
---|---|
37 | |
25 | |
19 | |
14 | |
8 |
User | Count |
---|---|
68 | |
48 | |
45 | |
18 | |
15 |