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

Pareto Analysis for Top N Accounts

Hi All,

 

I have Top N Parameter, Entier Report want to change based on Top N Parameter Value (Table, Pareto Chart and KPI)

 

I can control Table By using below Script 

Is Top X selected? = 
IF (
    RANKX (
        ALL ( 'Opportunity'[AccountId] ),
        CALCULATE ( SUM ( 'Opportunity'[Amount] ) ),
        ,
        DESC,
        DENSE
    )
        <= SELECTEDVALUE ( 'Top N Account'[Top N Account Parameter] ),
    "Yes"
)

But I can't control Pareto Chart and KPI Value

 

Ex: I have given 10 as the parameter value, So Table shows 11 accounts because  two accounts have the same value 

 

I want to perform a Pareto analysis only for these 11 accounts and KPI want to so 11 

 

How can i achieve this logic 

Screenshot_3.png

 

Data:

 

AccountIdOpportunity IdAmountCreatedDateCloseDateGroup Opportunities
0011I000008SIShQAO0061I000005YRCMQA45000011/8/20178/26/2017Win
0011I000008SIShQAO0061I000005YRCbQAO4000011/8/201711/10/2017Active
0011I000008SIShQAO0061I000005YRCFQA43000011/8/201711/4/2017Win
0011I000008SISiQAO0061I000005YRCUQA410000011/8/20179/10/2017Win
0011I000008SISjQAO0061I000005YRCHQA47500011/8/20179/13/2017Loss
0011I000008SISkQAO0061I000005YRC7QAO2500011/8/20179/17/2017Active
0011I000008SISlQAO0061I000005YRCBQA47500011/8/20177/27/2017Active
0011I000008SISlQAO0061I000005YRCZQA45000011/8/201710/16/2017Win
0011I000008SISlQAO0061I000005YRCPQA4500011/8/201710/18/2017Win
0011I000008SISmQAO0061I000005YRCCQA412000011/8/201710/20/2017Active
0011I000008SISmQAO0061I000005YRCDQA410000011/8/201710/27/2017Win
0011I000008SISmQAO0061I000005YRCaQAO8500011/8/20179/29/2017Active
0011I000008SISmQAO0061I000005YRCVQA45000011/8/20179/12/2017Win
0011I000008SISnQAO0061I000005YRCSQA48500011/8/20177/31/2017Active
0011I000008SISnQAO0061I000005YRCIQA43500011/8/20177/30/2017Active
0011I000008SISnQAO0061I000005YRC9QAO500011/8/20178/1/2017Win
0011I000008SISoQAO0061I000005YRCTQA415000011/8/20178/9/2017Win
0011I000008SISoQAO0061I000005YRCRQA42000011/8/20178/2/2017Active
0011I000008SISoQAO0061I000005YRCGQA41000011/8/20178/5/2017Win
0011I000008SISrQAO0061I000005YRCKQA415000011/8/201711/1/2017Win
0011I000008SISrQAO0061I000005YRCAQA48500011/8/20179/8/2017Win
0011I000008SISrQAO0061I000005YRCJQA42000011/8/201710/29/2017Active
0011I00000EmeOlQAJ0061I000007S2RYQA010000012/29/201712/31/2017Active
0011I00000EmeOmQAJ0061I000007S2RWQA01500012/29/201712/31/2017Active
0011I00000EmeOnQAJ0061I000007S2RXQA012000012/29/201712/31/2017Active
0011I00000EmeOoQAJ0061I000007S2pDQAS12000012/29/201711/27/2017Active
0011I00000EmeOoQAJ0061I000007S2p8QAC8500012/29/201710/31/2017Active
0011I00000EmeOoQAJ0061I000007S2pAQAS5000012/29/20171/9/2018Active
0011I00000EmeOpQAJ0061I000007S2p5QAC5000012/29/201710/13/2017Active
0011I00000EmeOpQAJ0061I000007S2p6QAC2500012/29/20176/9/2017Win
0011I00000EmeOpQAJ0061I000007S2p7QAC500012/29/201711/16/2017Active
0011I00000EmeOqQAJ0061I000007S2p4QAC15000012/29/20172/1/2016Loss
0011I00000EmeOqQAJ0061I000007S2otQAC12000012/29/201710/13/2017Active
0011I00000EmeOqQAJ0061I000007S2owQAC12000012/29/20176/15/2017Loss
0011I00000EmeOqQAJ0061I000007S2p0QAC500012/29/201712/21/2017Active
0011I00000EmeOrQAJ0061I000007S2ooQAC8500012/29/20175/30/2017Win
0011I00000EmeOrQAJ0061I000007S2oqQAC5000012/29/201712/30/2015Loss
0011I00000EmeOsQAJ0061I000007S2oiQAC3500012/29/201710/23/2015Win
0011I00000EmeOsQAJ0061I000007S2ohQAC3000012/29/201710/3/2015Loss
0011I00000EmeOtQAJ0061I000007S2ogQAC500012/29/201711/4/2017Active
0011I00000EmeOuQAJ0061I000007S2ocQAC24000012/29/20172/28/2017Win
0011I00000EmeOuQAJ0061I000007S2oYQAS2000012/29/20177/16/2015Loss
0011I00000EmeOuQAJ0061I000007S2obQAC1500012/29/201711/1/2017Active
0011I00000EmeOwQAJ0061I000007S2oLQAS12000012/29/20172/29/2016Win
0011I00000EmeOwQAJ0061I000007S2oMQAS10000012/29/20172/21/2015Win
0011I00000EmeOwQAJ0061I000007S2oFQAS500012/29/20176/23/2016Loss
0011I00000EmeOxQAJ0061I000007S2oBQAS15000012/29/201712/18/2015Loss
0011I00000EmeOxQAJ0061I000007S2oCQAS15000012/29/20172/7/2017Win
0011I00000EmeOyQAJ0061I000007S2o6QAC7500012/29/20171/9/2018Active
0011I00000EmeOyQAJ0061I000007S2o8QAC3000012/29/20172/10/2015Win
0011I00000EmeOyQAJ0061I000007S2o5QAC1000012/29/20174/3/2016Loss
0011I00000EmeOyQAJ0061I000007S2o7QAC500012/29/201712/22/2017Active
1 ACCEPTED SOLUTION
8 REPLIES 8
Anonymous
Not applicable
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Do you like this?

Capture17.JPG

 

Measure = SUM('Table'[Amount])

Measure 2 = RANKX(ALL('Table'[AccountId]),[Measure],,DESC,Dense)

Measure 3 =
CALCULATE (
    DISTINCTCOUNT ( 'Table'[AccountId] ),
    FILTER (
        ALL ( 'Table'[AccountId] ),
        [Measure 2] <= SELECTEDVALUE ( 'Table 2'[topn] )
    )
)


Measure 4 =
VAR amount1 = [Measure]
VAR total1 =
    CALCULATE ( [Measure], ALL ( 'Table' ) )
RETURN
    CALCULATE ( [Measure], FILTER ( ALL ( 'Table' ), [Measure] >= amount1 ) ) / total1
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

x

Anonymous
Not applicable

Thanks for quick response  @v-juanli-msft   

 

 

 

 

Top N Account Table = SUMMARIZECOLUMNS ( 'Opportunity'[AccountId],  "Sales", SUM( Opportunity[Amount] ), 
FILTER(ALL('Opportunity'[AccountId]),[Measure2]<=  SELECTEDVALUE('Table 2'[topn])
)

 

If I segregated top N account & amount value in the separate table means I can apply the Pareto Chart easily   

 

Hi @Anonymous 

Use [Measure 3] in KPI visual, it would show top n data as expected.

Measure 3 = CALCULATE(DISTINCTCOUNT('Table'[AccountId]),FILTER(ALL('Table'[AccountId]),[Measure 2]<=SELECTEDVALUE('Table 2'[topn])))

Add [measure 5] in the visual level filter of the Pareto Chart(column &line chart)

Measure = SUM('Table'[Amount])

Measure 2 = RANKX(ALL('Table'[AccountId]),[Measure],,DESC,Dense)

Measure 4 = var amount1=[Measure] var total1=CALCULATE([Measure],ALL('Table')) return CALCULATE([Measure],FILTER(ALL('Table'),[Measure]>=amount1))/total1

Measure 5 = IF([Measure 2]<=SELECTEDVALUE('Table 2'[topn]),1,0)

Capture8.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-juanli-msft 

 

Account was filtered based on Top N account filter, but Pareto Line was not changed 

 

My Expectation was  Pareto line value also want to be change based on the filtered account value

Screenshot_7.png 

Hi @Anonymous 

Igonre previous ones, check the new solution

red is a calculated column, others are measures

measure_of_amount = SUM('Table'[Amount])

this is a caluclated column Column_rank = RANKX ( ALL ( 'Table' ), CALCULATE ( SUM ( 'Table'[Amount] ), ALLEXCEPT ( 'Table', 'Table'[AccountId] ) ), , DESC, DENSE ) Measure_rank = RANKX ( ALL ( 'Table'[AccountId] ), [measure_of_amount],, DESC, DENSE ) count_id = CALCULATE ( DISTINCTCOUNT ( 'Table'[AccountId] ), FILTER ( ALL ( 'Table'[AccountId] ), [Measure_rank] <= SELECTEDVALUE ( 'Table 2'[topn] ) ) ) flag = IF(MAX([Column_rank])<=SELECTEDVALUE('Table 2'[topn]),1,0) col_amount = IF([flag]=1,[measure_of_amount]) percent_clc = IF ( [flag] = 1, CALCULATE ( SUM ( 'Table'[Amount] ), FILTER ( ALLSELECTED ( 'Table' ), [Column_rank] <= MAX ( 'Table'[Column_rank] ) && [Column_rank] <= SELECTEDVALUE ( 'Table 2'[topn] ) ) ) / CALCULATE ( SUM ( 'Table'[Amount] ), FILTER ( ALLSELECTED ( 'Table' ), [Column_rank] <= SELECTEDVALUE ( 'Table 2'[topn] ) ) ) )

Capture13.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi 

 

I have filtered Close Date, again it shows the wrong result  

 

I have posted my exact requirement in the below URL, Could you please assist me to resolve this issue? 

https://community.powerbi.com/t5/Desktop/Pareto-Analysis-for-Top-N-account-based-on-closed-Date-Filt... 

Screenshot_8.png

Hi @Anonymous 

If you use "summarized" function to create a calculated table, the value on the chart can't be changed based on the parameter selected.

You could find the measure in the visual level filter from my screenshot,

It will limit the chart to show only top 10 data.

Capture7.JPG

For more details, please download my pbix to find how to create these measures

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.