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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors