Forum

Remove Last Row Bas...
 
Notifications
Clear all

Remove Last Row Based Upon New Data of Different Column

4 Posts
2 Users
0 Reactions
117 Views
(@novusexcel)
Posts: 67
Estimable Member
Topic starter
 

Wondering the best way to go about this.

I have a query that to begin, has one row like this.  This is the row to show when there is no other data:

Column1                Column2

Not Started             null

This is how it should look with no other data.  

As data comes in, it looks like this:

Column1                Column2

Test                        Yes

Not Started              null

What I would like for it to look like is this:

Column1                Column2

Test                       Yes

Basically, to start, I want the "Not Started" row to remain.  However, as soon as Column2 populates with data, I would like the "Not Started" row to be removed.  Filtering is not accomplishing what I would like.    

I was looking to basically remove the last row based upon Colum2 not being null.  But if it is null, I need to keep that last row.  

 
Posted : 27/02/2023 6:45 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi,

You could do a test to see how many rows are in the table.  If there are more than 1, then remove the last row

= if Table.RowCount(Source) > 1 then Table.RemoveLastN(Source,1) else Source

Regards

Phil

 
Posted : 28/02/2023 7:41 pm
(@novusexcel)
Posts: 67
Estimable Member
Topic starter
 

Very interesting thought.  That does the trick for my example.  Never thought of that.  Thank you very much for the suggestion.

 
Posted : 01/03/2023 8:52 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

No worries

 
Posted : 01/03/2023 8:59 am
Share: