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
Arnault_
Resolver III
Resolver III

Filter / Summarize Table by Max Value index

Hi All,

I have one table with duplicated rows. I would like to remove these duplicates. It can be achieved by using one column and keeping the highest index. Here is a simple example. For each period and each item, I would like to have only 1 row. 

I have tried this formula:

 

_MyTable2 = 
var _maxindex = CALCULATE ( MAXX (Table_test,  Table_test[category_index] ) , ALLEXCEPT ( Table_test, Table_test[item] ) )
RETURN 
FILTER (Table_test, Table_test[category_index] = _maxindex )

 

 

In January, I have 2 rows for item A and I would like to keep only the one with the max index (=2)

In January, I have 1 row for item B and I want to keep it. My formula works.

 

However, in February I should have 1 row for each item with same logic. In that case, the row with the item A is not retreived, just like if the index of A (1) is compared with the index of B (2). Please see the 2 tables below (initial and expected). I hope you can help me solve this. Thanks in advance.

 

The initial table :

Perioditemcategorycategory_index
01/01/2021AX2
01/01/2021AY1
01/01/2021BX2
01/02/2021AY1
01/02/2021BX2
01/02/2021BY1
01/03/2021AX2
01/03/2021AY1

 

 

And the expected output:

Perioditemcategory
01/01/2021AX
01/01/2021BX
01/02/2021AY
01/02/2021BX
01/03/2021A

X

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Arnault_ ,

You can create a flag column new column

=

var _max - maxx(filter(Table, [Period] = earlier([Period]) && [item] = earlier([item] ) ) , [category_index] )

return

if([category_index] =_max, false(), true())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
David-Ganor
Resolver II
Resolver II

@Arnault_ Please try:

_MyTable2 =
var _maxindex =MAX(Table_test[category_index])

RETURN
MAXX(FILTER (Table_test, Table_test[category_index] = _maxindex ),Table_test[category])
amitchandak
Super User
Super User

@Arnault_ ,

You can create a flag column new column

=

var _max - maxx(filter(Table, [Period] = earlier([Period]) && [item] = earlier([item] ) ) , [category_index] )

return

if([category_index] =_max, false(), true())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak ,

Thanks for your ansnwer.

I actually created 2 columns applying the same logic:

 

Max_index = CALCULATE ( MAX ( Table_test[category_index] ),
    ALLEXCEPT ( Table_test, Table_test[item],Table_test[Period] )
)

 

Max_Index_YorN = 
If ( Table_test[Max_index] = Table_test[category_index], 1, 0 )

 

 

 

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