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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
StidifordN
Helper III
Helper III

Calculated Table, remove duplicates resulting from MAX of field

I have a calculated table to return a supplier and their levels of categorisation (to be looked up to in another table). Problem is our raw data has multiple categories/sub categories for a single supplier that i want reduced to a single category/sub category per supplier.

It is possible to amend the calculated table formula to remove all duplicate BUT leaving the entry that is the highest spend (max).  All unique entries to remain unaffected.

 

SupplierCats = 
FILTER(
  SUMMARIZE(APAll,APAll[PTRN_SUPP],APAll[SpendCategory],APAll[SpendSubCategory],"Count",COUNT(APAll[PTRN_SUPP]),"Value",MAX(APAll[NET_AMOUNT_AU])),
  APAll[SpendCategory]<>BLANK()
)

The highlighted yellow suppliers below are duplicates - the item with the highest spend is the entry that should remain out of the 3.

Capture987.JPG

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @StidifordN,

 

For you scenario, you could create another measure then you could achieve your desired output.

 

tag =
IF (
    CALCULATE ( SELECTEDVALUE ( 'SupplierCats'[Value] ) )
        = CALCULATE (
            MAX ( 'SupplierCats'[Value] ),
            ALLEXCEPT ( SupplierCats, SupplierCats[PTRN_SUPP] )
        ),
    1,
    0
)

Then drag this measure to visual level filter and show the item when value is 1.

 

measure.PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @StidifordN,

 

For you scenario, you could create another measure then you could achieve your desired output.

 

tag =
IF (
    CALCULATE ( SELECTEDVALUE ( 'SupplierCats'[Value] ) )
        = CALCULATE (
            MAX ( 'SupplierCats'[Value] ),
            ALLEXCEPT ( SupplierCats, SupplierCats[PTRN_SUPP] )
        ),
    1,
    0
)

Then drag this measure to visual level filter and show the item when value is 1.

 

measure.PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Mate - perfect!

For my purpose I applied this as a column and the result was still spot on.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.