Thank you, I have added the following queries:
= Table.ReplaceValue(#"Changed Type3",each[Lot Closed On],each if [Status] <> "Closed-out" then null else [Lot Closed On],Replacer.ReplaceValue,{"Lot Closed On"})
= Table.ReplaceValue(#"Replaced Value",each [Lot Created On],each if [Lot Created On] = null then [Lot Opened On] else [Lot Created On],Replacer.ReplaceValue,{"Lot Created On"})
= Table.ReplaceValue(#"Replaced Value1",each[Lot Opened On],each if [Status] = "Cancelled" then null else [Lot Opened On],Replacer.ReplaceValue,{"Lot Opened On"})
= Table.ReplaceValue(#"Replaced Value2",each[Lot Opened On],each if [Status] = "Assign Lot Number" then null else [Lot Opened On],Replacer.ReplaceValue,{"Lot Opened On"})
and now I want to add one more replace the value in [Lot opened on] to check for "lot completion notification" in [Status] and null values in lot opened on and if this condition is correct add [ Lot created on]
Can you help please?
------------------------------
Ahmed Kamal
Quality
------------------------------
Original Message:
Sent: May 16, 2022 02:51 AM
From: James Watts
Subject: Change data based on multiple conditions
#"Source" is the reference to a previous step that loads the data, e.g. if you were loading data from Oracle:
let
Source = Oracle.Database("max75p", [Query="Select.. from ....", CreateNavigationProperties=false]),
------------------------------
James Watts
Business Intelligence Analyst
Original Message:
Sent: May 15, 2022 08:36 PM
From: Ahmed Kamal
Subject: Change data based on multiple conditions
What is "Source" referred to in the step?
------------------------------
Ahmed Kamal
Quality
Original Message:
Sent: May 13, 2022 02:56 AM
From: James Watts
Subject: Change data based on multiple conditions
Have a look at Step 3 in Replace Values in Power Query M (Ultimate Guide) - Gorilla BI .
Basically, you want to add an M language step after the data load, with something like
= Table.ReplaceValue(#"Source",each [Lot Closed On], each if [Lot Status Title] = "Open Lot" then null else [Lot Closed On],Replacer.ReplaceValue,{"Lot Closed On"})
(i.e. don't do it in DAX, do data transform steps after loading the data)
------------------------------
James Watts
Business Intelligence Analyst
Original Message:
Sent: May 12, 2022 06:25 PM
From: Ahmed Kamal
Subject: Change data based on multiple conditions
Hello,
I have a data set (6 columns) and multiple rows, and I want to make some data transformations.
Lot No | Title | Lot Status Title | Lot Created On | Lot Opened On | Lot Closed On |
210216 - SIL TRIAL- SMOOTH DRUM | Name1 | Cancelled | 16/02/2021 | | |
WSA10-AARU-DRG-RCBC-000001 | Name2 | Open Lot | 16/03/2022 | 16/03/2022 | |
WSA10-AARU-DRG-RCBC-000002 | Name3 | Open Lot | 4/04/2022 | 31/03/2022 | |
WSA10-AARU-DRG-RCBC-000003 | Name4 | Assign Lot Number | 14/04/2022 | | |
WSA10-AARU-DRG-RCBC-000004 | Name5 | Open Lot | 2/05/2022 | 2/05/2022 | |
WSA10-AARU-ENV-CLNR-000001 | Name6 | Open Lot | 3/03/2022 | 3/03/2022 | |
WSA10-AARU-EWK-CLGR-000001 | Name7 | Open Lot | 3/03/2022 | 3/03/2022 | |
WSA10-AARU-EWK-CLGR-000002 | Name8 | Open Lot | 3/03/2022 | 3/03/2022 | |
WSA10-AARU-EWK-CLGR-000003 | Name9 | Open Lot | 3/03/2022 | 3/03/2022 | 20/04/2021 |
WSA10-AARU-EWK-EXCV-000001 | Name10 | Open Lot | 9/05/2022 | 9/05/2022 | 20/04/2021 |
WSA10-AARU-EWK-TOPS-000001 | Name11 | Open Lot | 4/05/2022 | 4/05/2022 | 20/04/2021 |
WSA10-AARU-EWK-TOPS-000002 | Name12 | Assign Lot Number | 4/05/2022 | | |
WSA10-AARU-UTS-ELER-000001 | Name13 | Open Lot | 28/03/2022 | 28/03/2022 | |
WSA10-AARU-UTS-TELE-000001 | Name14 | Open Lot | 6/05/2022 | 6/05/2022 | |
WSA10-AARU-UTS-WATE-000001 | Name15 | Open Lot | 11/05/2022 | 10/05/2022 | |
WSA10-ASAR-DRG-BACK-000001 | Name16 | Cancelled | 10/12/2019 | | |
WSA10-ASAR-EWK-GNFL-000001 | Name17 | Open Lot | 8/11/2021 | 8/11/2021 | |
WSA10-ASAR-EWK-REPT-000001 | Name18 | Cancelled | 12/02/2021 | | |
WSA10-ASAR-EWK-REPT-000002 | Name19 | Closed-out | 24/02/2021 | 1/03/2021 | 20/04/2021 |
WSA10-ASAR-PCC-RCPM-000001 | Name20 | Open Lot | 10/11/2021 | 10/11/2021 | |
WSA10-ASAR-STR-REIN-000001 | Name21 | Open Lot | 11/11/2021 | 11/11/2021 | |
WSA10-BASIN 2-EWK-CLGR-000001 | Name22 | Closed-out | | 13/10/2021 | 8/11/2021 |
WSA10-BASIN10-DRG-DRML-000001 | Name23 | Open Lot | 26/10/2021 | 26/10/2021 | |
WSA10-BASIN10-DRG-DRML-000002 | Name24 | Open Lot | 1/12/2021 | 26/10/2021 | |
WSA10-BASIN10-DRG-DRML-000003 | Name25 | Closed-out | 8/12/2021 | 15/12/2021 | 22/04/2022 |
WSA10-BASIN10-DRG-DRML-000004 | Name26 | Closed-out | | 13/12/2021 | 11/01/2022 |
WSA10-BASIN10-DRG-DRML-000005 | Name27 | Lot Completion Notification | 4/04/2022 | 12/04/2022 | |
1- To delete the date in column F (Lot close on) if the Status in column C (Lot Status Title) is Open lot (see text in bold)
2- To add the same date in column D (Lot created on) in column E (Lot Opened On) if Status is Open lot and Open date is blank
In general, I want to check column C for various statuses and change the date accordingly based on the specific condition.
Thanks
Ahmed
------------------------------
Ahmed Kamal
Quality Engineer
------------------------------