Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Reply
Tejas8275
Regular Visitor

Need solution

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 . 

 

1 ACCEPTED SOLUTION
jeroendekk
Responsive Resident
Responsive Resident

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.
image1.jpg
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.image2.jpg

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!!


View solution in original post

2 REPLIES 2
jeroendekk
Responsive Resident
Responsive Resident

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.
image1.jpg
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.image2.jpg

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!!


Thank You @jeroendekk , really appreciate your help and quick response !!!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.