简体   繁体   中英

PowerBI: Group by key, retrieve last nonblank value off another row with filters

I'm trying to plug the holes on the dataset that I currently have. My N_order is the key for grouping. As you can see in below example, I've null values for the column ship_meth, when the status is 'fulfilled'.

I'd love to create a new desired_column that can retrieve the value from any of the other statuses for that N_order (for example, 'new_order') and paste it on the row with the 'fulfilled' status.

I'm not able to provide a solid example of what I've been trying, as is not working anywhere near what I'd like. Just going to point out that it doesnt work with filldown/up function as i've different statuses on the orders, and different ship_meth.

N_order ship_meth status desired_column
50010000116187 ENKM picked ENKM
50010000116187 ENKM accepted ENKM
50010000116187 null fulfilled ENKM
50010000116325 null fulfilled ENRC
50010000116325 ENRC accepted ENRC
50010000116325 ENRC rejected ENRC

Appreciate your time and effort.

Suk

Update

You could try:

desired = CALCULATE(LASTNONBLANK(Tabelle1[ship_meth], Tabelle1[ship_meth]), FILTER(all(Tabelle1), [N_order] = EARLIER(Tabelle1[N_order])))

Output:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM