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
Anonymous
Not applicable

Not consider duplicate IDs in a Top N

Hi all,

 

I´m trying to order a similar table in PBI, by sales desc. The thing is that I´d like to discard those companies with the same ID as it´s the case for Accesories and Accesories SL

JorgeRG_0-1652705388761.png

I tried creating this column to replace Company column but it´s grouping the sales by ID and, that it´s not the expected result.

 

New_company= 

var a = CALCULATECOUNT(Table[id]), FILTER(Table, Table[id] = EARLIER(Table[id])) )
return
IF(a >1,
        CALCULATEMIN(SADB_Trends[partner_name]), FILTER(Table, Table[id]= EARLIER(Table[id])) ,
        Table[id] )
 
 
Many thanks in advance

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

I have assumed that you have an ID column. Please try the following : 

1. Create a calculated column on your table to give you the min value of company for each ID.

Min Value =
CALCULATE(
MIN(CompSales[Company]),
ALLEXCEPT(CompSales, CompSales[ID])
)

 

rohit_singh_0-1652708338117.png

2) Using ths table, create a calculated table that has company and sales

Min Sales =

SUMMARIZE(
CompSales,
CompSales[Min Value],
CompSales[Sales]
)

rohit_singh_1-1652708438462.png

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊

View solution in original post

5 REPLIES 5
rocky09
Solution Sage
Solution Sage

You have mentioned ID, where is the ID in you example?

Anonymous
Not applicable

True but it´s in the same table as the rest of the data. To make it easier just consider that if the sales quantity is the same, it´s means that they have the same ID 😅

PC2790
Community Champion
Community Champion

Hey @Anonymous ,

 

Can you show the current result and the expected result please?

Anonymous
Not applicable

Sure, this would be:

JorgeRG_0-1652707171826.png

 I´d like to get for example, the min of company column in case the ID is duplicated

Hi @Anonymous ,

I have assumed that you have an ID column. Please try the following : 

1. Create a calculated column on your table to give you the min value of company for each ID.

Min Value =
CALCULATE(
MIN(CompSales[Company]),
ALLEXCEPT(CompSales, CompSales[ID])
)

 

rohit_singh_0-1652708338117.png

2) Using ths table, create a calculated table that has company and sales

Min Sales =

SUMMARIZE(
CompSales,
CompSales[Min Value],
CompSales[Sales]
)

rohit_singh_1-1652708438462.png

 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.