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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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