Forum Discussion
Remove duplicate rows from a filtered table
- 4 years ago
Hi oliverblane ,
Not quite sure what your logic is for remove duplicate rows. Based on ID or based on id+Establishment.
IF ID, you can add an index column and try this code to keep the recent date rows.
Create_date_m = VAR _maxdate = CALCULATE( MAX( 'Table'[Create_Date] ), ALLEXCEPT( 'Table', 'Table'[ID] ) ) VAR _c_index = CALCULATE( MAX( 'Table'[Index] ), FILTER( ALLEXCEPT( 'Table', 'Table'[ID] ), [Create_Date] = _maxdate ) ) RETURN IF( MAX( 'Table'[Index] ) = _c_index, _maxdate, BLANK() )And in the vsiual table , replace create_date with above measure. Use the slicer to filter date range.
The result:
I put my pbix file in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi oliverblane ,
Not quite sure what your logic is for remove duplicate rows. Based on ID or based on id+Establishment.
IF ID, you can add an index column and try this code to keep the recent date rows.
Create_date_m =
VAR _maxdate =
CALCULATE( MAX( 'Table'[Create_Date] ), ALLEXCEPT( 'Table', 'Table'[ID] ) )
VAR _c_index =
CALCULATE(
MAX( 'Table'[Index] ),
FILTER( ALLEXCEPT( 'Table', 'Table'[ID] ), [Create_Date] = _maxdate )
)
RETURN
IF( MAX( 'Table'[Index] ) = _c_index, _maxdate, BLANK() )
And in the vsiual table , replace create_date with above measure. Use the slicer to filter date range.
The result:
I put my pbix file in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- oliverblane4 years ago
Helper III
Thank you for this!