The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello All,
I need help to remove rows when column A is same & column B is rejected such that only unique row having column A & B as rejected is acheived :
Data :
Sr no. Column A Column B Column C
1 A1 Rejected Mumbai
2 B1 Accepted Kolkata
3 C1 Rejected Jaipur
4 A1 Rejected Pune
Excepted result :
Sr no. Column A Column B Column C
1 A1 Rejected Mumbai
2 B1 Accepted Kolkata
3 C1 Rejected Jaipur
Please suggest some solution . I have tried using nested if statement but i am unable to get result .
Solved! Go to Solution.
Hi @Tejas8275
There is a solution in Power Query to add a grouped index. Curbal has a video about it here.
Add index to subgroups in Power Query - YouTube
So in your data you would do an advanced grouping by Column A & Column B. Select All rows.
Then you would add an index column with a custom function
= Table.AddColumn(#"Grouped Rows", "Index", each Table.AddIndexColumn([Data],"Index",1,1))
Then remove the other column and expand the index column. Your data will look like this.
Then you can select only the the rows that are either accepted or have an index of 1 with a new step.
= Table.SelectRows(#"Expanded Index", each ([Index.1] = 1 or [ColumnB] <> "Rejected"
))
I hope this helps.
Best regards,
Jeroen Dekker
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Hi @Tejas8275
There is a solution in Power Query to add a grouped index. Curbal has a video about it here.
Add index to subgroups in Power Query - YouTube
So in your data you would do an advanced grouping by Column A & Column B. Select All rows.
Then you would add an index column with a custom function
= Table.AddColumn(#"Grouped Rows", "Index", each Table.AddIndexColumn([Data],"Index",1,1))
Then remove the other column and expand the index column. Your data will look like this.
Then you can select only the the rows that are either accepted or have an index of 1 with a new step.
= Table.SelectRows(#"Expanded Index", each ([Index.1] = 1 or [ColumnB] <> "Rejected"
))
I hope this helps.
Best regards,
Jeroen Dekker
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
80 | |
77 | |
43 | |
39 |
User | Count |
---|---|
150 | |
116 | |
66 | |
64 | |
55 |