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

How to get Shop with most sales?

Hi there,

 

I'm trying to get the shop with the most sales in a Card visualisation. But I don't know how do this. 

 

The Sales column in this table is based on a measure.

 

michaelbend_0-1622646174385.png

 

So I want to have 'Berlijn' in the card.

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have done it in two ways.

 

1. Use the following formula to create measure:

 

Shop with the most sales =
MAXX ( FILTER ( 'Selling', [Sales] = MAXX ( 'Selling', [Sales] ) ), [Store] )

 

2. Use RANK() :

 

Use Rank =
CALCULATE (
    MAX ( 'Selling'[Store] ),
    FILTER ( 'Selling', RANKX ( ALL ( 'Selling' ), [Sales],, DESC, DENSE ) = 1 )
)

 

Here is the final outout:

Top1.PNG

Best Regards,
Eyelyn Qin
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

11 REPLIES 11
ninalee
Helper I
Helper I

I'd like to launch something like Huffy, too (here are the huffy reviews from real clients, by the way). As for the solution of your problem, the previous commenter had already given the best advice as for me, I have nothing to add. 

v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have done it in two ways.

 

1. Use the following formula to create measure:

 

Shop with the most sales =
MAXX ( FILTER ( 'Selling', [Sales] = MAXX ( 'Selling', [Sales] ) ), [Store] )

 

2. Use RANK() :

 

Use Rank =
CALCULATE (
    MAX ( 'Selling'[Store] ),
    FILTER ( 'Selling', RANKX ( ALL ( 'Selling' ), [Sales],, DESC, DENSE ) = 1 )
)

 

Here is the final outout:

Top1.PNG

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Pragati11
Super User
Super User

HI @Anonymous ,

 

You can created a calculated column as follows in Power BI:

flagCalc = 
IF(tablename[Sales] = MAX(tablename[Sales]), "YES", "NO")

 

Then create a card visual and move STORE column to it. Under visual filters for thid card visual, move the above calculated flagCalc column and set it to "YES".

 

This will give you BERLIJN in the card visual.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

I get this error: The MAX function only accepts a column reference as the argument number 1.

Hi @Anonymous ,

 

You need to create a calculated column. Are you creating a measure?

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

No , Modeling -> New Column

Hi @Anonymous ,

 

Can you share your DAX please? I think you are missing some brackets.

I tried creating similar column and don't get any error:

Pragati11_0-1622647620247.png

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

My sales is a measure and not in column. 

max = IF(Verkoop[Omzet] = MAX([Omzet]), "yes", "no")

Hi @Anonymous ,

 

This flag needs to be a calculated column not a measure as I mentioned earlier.

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

You don't understand.. To calculate the sales.

Sales = sumx(
Selling,
Selling[Amount]*(Selling[Price]-Selling[discount])
)

HI @Anonymous ,

 

Apologies I missed that your SALES is a calculated measure.

 

You can create a Ranking column something like below:

rankCol = RANKX(ALL(tablename[Store]), [salesMeasure], , ASC, DENSE)

 

Now use this rankCol as a visual level filter in your card visual with STORE value in it and set it to display rankCol = 1

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

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.