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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Delete double row with conditions on previous row

Hi all,

 

I'm trying to create a calculated column to use it as a filter (value 0 of 1) based on the table below. Double row must be filtered out based on the conditions of the previous row based on the table below.

 

EMPstartdateenddateCategoryrow to be removed
11-jan-201915-nov-2019NOVNo
116-nov-201931-dec-2019GSYes

 

In this case the last row must be removed and conditions are:

1. EMP value must be the same (double row) and,

2. the Category value of the row to be removed (in this case the second row) is 'GS' and the startdate is on or after 1-october-2019

3. the enddate of row to be kept (in this case first row) is on or after 1-october-2019.

 

The calculated column should return a value of 1 or 0. 1 for the row to be removed which I can use as page level filter in the report.

 

Thank you in advance,

Mirza

1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

hi,

 

According to your description, please try this measure and column:

EMP-check =

IF(CALCULATE(COUNTROWS(Table25),FILTER(ALL(Table25),Table25[EMP] in FILTERS(Table25[EMP])))>1,1,0)

Row to be removed =

IF([EMP-check]=1&&Table25[Category]="GS"&&(Table25[startdate]>=DATE(2019,10,1)||Table25[enddate]<=DATE(2019,10,1)),1,0)

 

Here is my test table:

38.png

The result shows:

39.png

Here is my test pbix file.

pbix 

If you still have questions about it, please for free to let me know.

 

Best Regards,

Giotto Zhi

View solution in original post

1 REPLY 1
v-gizhi-msft
Community Support
Community Support

hi,

 

According to your description, please try this measure and column:

EMP-check =

IF(CALCULATE(COUNTROWS(Table25),FILTER(ALL(Table25),Table25[EMP] in FILTERS(Table25[EMP])))>1,1,0)

Row to be removed =

IF([EMP-check]=1&&Table25[Category]="GS"&&(Table25[startdate]>=DATE(2019,10,1)||Table25[enddate]<=DATE(2019,10,1)),1,0)

 

Here is my test table:

38.png

The result shows:

39.png

Here is my test pbix file.

pbix 

If you still have questions about it, please for free to let me know.

 

Best Regards,

Giotto Zhi

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.