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.
when date is maximum and status is closed return "close" for the shipment for all dates and if max date has "Open" as status return "Open" for all dates for that shipments.
eg:
Shipments | Date | Status | New Status |
A | 7-Oct | Open | Close |
A | 8-Oct | OPen | Close |
A | 9-Oct | Close | Close |
B | 7-Oct | Open | Open |
C | 7-Oct | Open | Close |
A | 6-Oct | Open | Open |
B | 8-Oct | Open | Open |
B | 9-Oct | Open | Open |
C | 8-Oct | Close | Close |
Solved! Go to Solution.
Hi @insandur
please try
New Status =
VAR CurrentShipmentTable =
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Shipments] ) )
VAR LastRecord =
TOPN ( 1, CurrentShipmentTable, 'Table'[Date] )
RETURN
MAXX ( LastRecord, 'Table'[Status] )
Hi,
Please check the below picture and the attached pbix file whether it suits your requirement.
New Status CC =
MAXX (
FILTER (
Data,
Data[Shipments] = EARLIER ( Data[Shipments] )
&& Data[Date]
= MAXX (
GROUPBY (
FILTER ( Data, Data[Shipments] = EARLIER ( Data[Shipments] ) ),
Data[Shipments],
"@maxdate", MAXX ( CURRENTGROUP (), Data[Date] )
),
[@maxdate]
)
),
Data[Status]
)
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.
This worked, Thank you for quick response
Hi,
Please check the below picture and the attached pbix file whether it suits your requirement.
New Status CC =
MAXX (
FILTER (
Data,
Data[Shipments] = EARLIER ( Data[Shipments] )
&& Data[Date]
= MAXX (
GROUPBY (
FILTER ( Data, Data[Shipments] = EARLIER ( Data[Shipments] ) ),
Data[Shipments],
"@maxdate", MAXX ( CURRENTGROUP (), Data[Date] )
),
[@maxdate]
)
),
Data[Status]
)
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.
Hi @insandur
please try
New Status =
VAR CurrentShipmentTable =
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Shipments] ) )
VAR LastRecord =
TOPN ( 1, CurrentShipmentTable, 'Table'[Date] )
RETURN
MAXX ( LastRecord, 'Table'[Status] )
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 |
---|---|
49 | |
26 | |
20 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
43 | |
19 | |
18 |