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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
tannhq
Helper I
Helper I

Performance of running in total by ranking

Hello everybody,

 

I create a measure Running in total by [Total Sales] ranking, in order to know top customers by % of sales. 

tannhq_0-1664763096812.png

But the performance is so slow.  Can anyone have the idea or solution for this.

There are 2 measures that I'm using: 

Customer RANK =
IF (
    [Total Sales] > 0,
    IF (
        ISINSCOPE ( Customers[Code-Customer] ),
        RANKX (
            FILTER (
                ALLSELECTED ( Customers[Code-Customer] ),
                [Total Sales] > 0
            ),
            [Total Sales]
        )
    )
)
Total Sales Running In Total = 
VAR CurrentRank = [Customer RANK]
VAR SummaryCustomers =
    CALCULATETABLE (
        VALUES ( Customers[Code-Customer] ),
        FILTER ( ALLSELECTED ( Customers[Code-Customer] ), [Total Sales] > 0 )
    )
VAR CustomerAndRank =
    ADDCOLUMNS (
        SummaryCustomers,
        "@Sales", [Total Sales],
        "@Rank", [Customer RANK]
    )
VAR Result =
    SUMX ( FILTER ( CustomerAndRank, [@Rank] <= CurrentRank ), [@Sales] )
RETURN
    Result

 

 

Thanks very much.

2 REPLIES 2
amitchandak
Super User
Super User

@tannhq , Try like

 

Customer RANK =
RANKX (
FILTER (
ALLSELECTED ( Customers[Code-Customer] ),
[Total Sales] > 0
),
[Total Sales]
)


Total Sales Running In Total =
VAR CurrentRank = [Customer RANK]
VAR CustomerAndRank =
ADDCOLUMNS (filter( Sumamrize(Customers, Customers[Code-Customer] ),[Total Sales] > 0 )
SummaryCustomers,
"@Sales", [Total Sales],
"@Rank", [Customer RANK]
)
VAR Result =
SUMX ( FILTER ( CustomerAndRank, [@Rank] <= CurrentRank ), [@Sales] )
RETURN
Result

 

Also refer

https://exceleratorbi.com.au/pareto-analysis-in-power-bi/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak , 

Your measure return the same number of total sales.

I try to add ALL (or ALLSELECTED)  and the performance still is so slow.

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.