Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
Hi Team,
I have columns as below (excluding last column which the output Im trying to fetch) :
Emp ID | Mgr ID | Employee States | Manager States | States Missing |
G1 | G0 | A, B, C, D | A, B, D | C |
G2 | G0 | X, Y, Z, E, F | Y, Z, F | X, E |
Im trying to add a new column at the end "States Missing" with the values that are not present in Manager states compared to Employee states. Im trying to do this powerquery.
Kindly help
Solved! Go to Solution.
you can try this to create a new column in PQ
= Table.AddColumn(#"Changed Type", "Custom", each
[a=Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)(Text.Remove([Employee States]," ")),
b=Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)(Text.Remove([Manager States]," ")),
c=List.Difference(a,b),
d=Text.Combine(c,",")
][d])
Proud to be a Super User!
you can try this
= Table.AddColumn(Source, "Custom", each
[a=Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)(Text.Trim([Employee States]," ")),
b=Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)(Text.Trim([Manager States]," ")),
c=List.Difference(a,b),
d=Text.Combine(c,",")
][d])
Proud to be a Super User!
you can try this to create a new column in PQ
= Table.AddColumn(#"Changed Type", "Custom", each
[a=Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)(Text.Remove([Employee States]," ")),
b=Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)(Text.Remove([Manager States]," ")),
c=List.Difference(a,b),
d=Text.Combine(c,",")
][d])
Proud to be a Super User!
@ryan_mayu , Thank you. It did work with the sample data I provided. Thanks for the same.
In my original data i have company names with space included like the below. May I know how can i modify this query to suit this.
Employee States |
Am ciat, Brian be, Ceat kod, Doug fen |
you can try this
= Table.AddColumn(Source, "Custom", each
[a=Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)(Text.Trim([Employee States]," ")),
b=Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv)(Text.Trim([Manager States]," ")),
c=List.Difference(a,b),
d=Text.Combine(c,",")
][d])
Proud to be a Super User!
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
77 | |
73 | |
71 | |
45 | |
42 |
User | Count |
---|---|
48 | |
47 | |
29 | |
28 | |
28 |