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
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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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