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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Ibrahimashoor
New Member

Filter to show Top Stores with a specified combined sales

Hi all, 

I am trying to find away to show the top stores that represnts a  combined sales of 10B$ for example

 

Extra: would be to make this combines sales a whatIf parameter (that user can change from 1 , 2, ...10B)

 

Thank you in advanceimage.pngT

3 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

This screenshot should say it all.  I have applied a filter with the criteria of <=3000000000.  These are the measures i used

Rank of Stores by total sales = if(HASONEVALUE(Stores[StoreName]),RANKX(ALL(Stores[StoreName]),[Total Sales]),BLANK())
Cumulative sales = SUMX(TOPN([Rank of Stores by total sales],CALCULATETABLE(VALUES(Stores[StoreName]),ALL(Stores[StoreName])),[Total Sales]),[Total Sales])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi @Ibrahimashoor 

 

Try this

Measure = 
VAR __sales =
    ADDCOLUMNS(
        ALL( Stores[StoreName] ),
        "@sales", [Total Sales] 
    )
VAR __stors = 
SELECTCOLUMNS(
    FILTER(
        __sales,
        SUMX( 
            FILTER( 
                SELECTCOLUMNS( __sales, "@@sales", [@sales] ), 
                [@sales] < [@@sales] 
            ), 
            [@@sales] ) > MAX( 'selections'[selection] )
    ),
    "StoreName", Stores[StoreName]
)
RETURN 
    CALCULATE(
        [Total Sales],
        KEEPFILTERS( NOT Stores[StoreName] IN __stors )
    )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you very much. I have put the file in OneDrive (I couldn't load it here idrectly)

 

https://1drv.ms/u/s!AibcI9O4iXjagYNCJ3-Qrsl1xRYa8A?e=bvBtnU 

 

It is the standard Microsoft Contososales file

Hi @Ibrahimashoor 

 

Try this

Measure = 
VAR __sales =
    ADDCOLUMNS(
        ALL( Stores[StoreName] ),
        "@sales", [Total Sales] 
    )
VAR __stors = 
SELECTCOLUMNS(
    FILTER(
        __sales,
        SUMX( 
            FILTER( 
                SELECTCOLUMNS( __sales, "@@sales", [@sales] ), 
                [@sales] < [@@sales] 
            ), 
            [@@sales] ) > MAX( 'selections'[selection] )
    ),
    "StoreName", Stores[StoreName]
)
RETURN 
    CALCULATE(
        [Total Sales],
        KEEPFILTERS( NOT Stores[StoreName] IN __stors )
    )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Hi,

This screenshot should say it all.  I have applied a filter with the criteria of <=3000000000.  These are the measures i used

Rank of Stores by total sales = if(HASONEVALUE(Stores[StoreName]),RANKX(ALL(Stores[StoreName]),[Total Sales]),BLANK())
Cumulative sales = SUMX(TOPN([Rank of Stores by total sales],CALCULATETABLE(VALUES(Stores[StoreName]),ALL(Stores[StoreName])),[Total Sales]),[Total Sales])

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.