Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
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] )
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.