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] )
Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.
Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!
Join the biggest FREE Business Applications Event in LATAM this February.
User | Count |
---|---|
105 | |
87 | |
45 | |
31 | |
29 |
User | Count |
---|---|
142 | |
105 | |
98 | |
50 | |
43 |