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
mbagwan
Frequent Visitor

Cálculo del cuartil

¿Puede alguien por favor ayudarme a calcular

Porcentaje de clientes que aportan el 1er cuartil (top 25%) de ingresos
Porcentaje de clientes que aportan el 2o cuartil (25%-50%) de ingresos
Porcentaje de clientes que aportan el tercer cuartil (50%-75%) de ingresos
Porcentaje de clientes que aportan el 4o cuartil (75%-100%) de ingresos
Básicamente, necesito mostrar un gráfico de barras que mostrará 4 barras para cada cuartil como se mencionó anteriormente.
Gracias
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hola, @mbagwan

Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.

Mesa:

a1.png

Cuartil:

a2.png

Puede crear una medida como se indica a continuación.

Percentage = 
var total = CALCULATE(DISTINCTCOUNT('Table'[CustomerID]),ALL('Table'))
var tab = 
ADDCOLUMNS(
    ALL('Table'),
    "Rank",
    RANKX(
        ALL('Table'),
        [Revenue Contribution],,ASC
    )
)
var newtab = 
SUMMARIZE(
    Quartile,
    Quartile[Quartile],
    "Count",
    SWITCH(
        [Quartile],
        "quartile1",
        DIVIDE(
            COUNTROWS(
                FILTER(
                    tab,
                    [Rank]>=1&&[Rank]<total*0.25
                )
            ),
            total
        ),
        "quartile2",
        DIVIDE(
            COUNTROWS(
                FILTER(
                    tab,
                    [Rank]>=total*0.25&&[Rank]<total*0.5
                )
            ),
            total
        ),
        "quartile3",
        DIVIDE(
            COUNTROWS(
                FILTER(
                    tab,
                    [Rank]>=total*0.5&&[Rank]<total*0.75
                )
            ),
            total
        ),
        "quartile4",
        DIVIDE(
            COUNTROWS(
                FILTER(
                    tab,
                    [Rank]>=total*0.75&&[Rank]<=total            )
            ),
            total
        )
    )
)
return
SUMX(
    newtab,
    [Count]
)

Resultado:

a3.png

Saludos

Allan

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hola

Por favor, comparta algunos datos con los que trabajar.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-alq-msft
Community Support
Community Support

Hola, @mbagwan

Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.

Mesa:

a1.png

Cuartil:

a2.png

Puede crear una medida como se indica a continuación.

Percentage = 
var total = CALCULATE(DISTINCTCOUNT('Table'[CustomerID]),ALL('Table'))
var tab = 
ADDCOLUMNS(
    ALL('Table'),
    "Rank",
    RANKX(
        ALL('Table'),
        [Revenue Contribution],,ASC
    )
)
var newtab = 
SUMMARIZE(
    Quartile,
    Quartile[Quartile],
    "Count",
    SWITCH(
        [Quartile],
        "quartile1",
        DIVIDE(
            COUNTROWS(
                FILTER(
                    tab,
                    [Rank]>=1&&[Rank]<total*0.25
                )
            ),
            total
        ),
        "quartile2",
        DIVIDE(
            COUNTROWS(
                FILTER(
                    tab,
                    [Rank]>=total*0.25&&[Rank]<total*0.5
                )
            ),
            total
        ),
        "quartile3",
        DIVIDE(
            COUNTROWS(
                FILTER(
                    tab,
                    [Rank]>=total*0.5&&[Rank]<total*0.75
                )
            ),
            total
        ),
        "quartile4",
        DIVIDE(
            COUNTROWS(
                FILTER(
                    tab,
                    [Rank]>=total*0.75&&[Rank]<=total            )
            ),
            total
        )
    )
)
return
SUMX(
    newtab,
    [Count]
)

Resultado:

a3.png

Saludos

Allan

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Hi, please note that the CustomerID and Revenue are in two different tables as per my data.

Could you please help on that

amitchandak
Super User
Super User

I tried but that's not working

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.