Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
rashidanwar
Advocate II
Advocate II

Fill a column all records, with values from a 2nd column based on 3rd column having unique IDs

Hi everybody,

I have an order table with multipe orderlines against a unique order ID. 
Requirement: If status column contains shipped or ready even for a one line item I want to fill all the rows for that specific order ID in custom_column  with the word shipped.
order_id             line_item         status            custom_column
1                        abc                  shipped         shipped
1                        def                   pending        shipped
1                        ghi                   ready             shipped
1                        klm                  shipped          shipped
2                        nop                 penidng 
2                        qrs                  penidng

Thank you so much for any help in this regard.
Rashid Anwar

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@rashidanwar , a new column

new column =
var _cnt = countx(filter(Table, [order_id] =earlier([order_id]) && [status] in {"shipped","ready"}),[Order_id])
return
if(isblank(_cnt), blank(), "shipped")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@rashidanwar , a new column

new column =
var _cnt = countx(filter(Table, [order_id] =earlier([order_id]) && [status] in {"shipped","ready"}),[Order_id])
return
if(isblank(_cnt), blank(), "shipped")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak Thank you so much man.
It worked!
Can you please shed some light on that how actually countx is working in this specific context?
Thank you.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors