The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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]
)
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]
)
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] )
User | Count |
---|---|
28 | |
10 | |
8 | |
6 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |