We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
My table has column name 'Unique Customer' and 'Promo ID'. if any of the row value 'Unique Customer' has a 'Promo ID' greater than null, then likes to create a new column 'VFP Customer' with "Y" as value. as shown below. The following VFP Customer is created manually.
| Unique Customer | Promo ID | VFP Customer |
| A AHAMED LEBBE/MANSO | 222023 | Y |
| A AHAMED LEBBE/MANSO | Y | |
| A AHAMED LEBBE/MANSO | Y | |
| AABID/MAHMMOUDMR | 222023 | Y |
| AABID/MAHMMOUDMR | Y | |
| AABID/MAHMMOUDMR | Y | |
| AABID/MAHMMOUDMR | Y | |
| AABID/MAHMMOUDMR | Y | |
| AABOEN/STIANMR | N | |
| AADITYA | N |
Solved! Go to Solution.
Hi @Sudheeshp ,
This is my easy-to-understand method.
1.Add a custom column to return 1 or 0.
2.Group by as follows.
3.Add a custom to return the result.
4.Expand the Tables in the column.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Sudheeshp ,
This is my easy-to-understand method.
1.Add a custom column to return 1 or 0.
2.Group by as follows.
3.Add a custom to return the result.
4.Expand the Tables in the column.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
See the code here (You will need to replace Source appropriately)
let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
ListNonBlanks = List.Buffer(List.Transform(List.Select(Table.ToRecords(Source), (x) => x[Promo ID] <> null), (x) => x[Unique Customer])),
#"Added Custom" = Table.AddColumn(Source, "ID VFP Customer", each if List.Contains(ListNonBlanks, [Unique Customer]) then "Y" else "N")
in
#"Added Custom"
I have to add as a custom column and apply this, is it??The following is my source!!
Folder.Files("C:\INVENTORY\YEAR\ALL FILES\RETAIL SALES\DAILY SALES\VFP ANALYSIS")
Open your file in PQ and in the code generated, copy the code ListNonBlanks till the end and paste into your code after Source.
I am so thankful for all the reply. Much much appreciated. however i do not know how to do this additional column by comparing two cell values:)🤔
Well, I am getting errors. I think the unique customer is a additional colu mn, and there are columns added in the power query, after importing
You can create a custom column and name it VFP Customer. Put following formula (if you don't need null in else, please replace it appropriately)
= if [Promo ID] <> null then "Y" else null
I have pasted a scenario samples. Please have a look
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 10 | |
| 9 | |
| 7 | |
| 7 | |
| 5 |