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
tracytran91
Helper III
Helper III

Dinámico Top N y otra Categoría

Hola amigos,

He hecho una dinámica Top N y otra Categoría.

Funciona bien cuando elegí Top 7. Sin embargo, Si elegí por debajo de la parte superior 7 como top 3 , top 6 .... "los otros" Categoría es 100%.

Untitled.png

OTHER = 
VAR TopNumber = if(HASONEVALUE('TopN'[Top N]),VALUES('TopN'[Top N]),20)
    VAR Rest =
        COUNTROWS ( D_Client ) - TopNumber
    RETURN
        IF (
            HASONEVALUE ( 'Client Name'[Client Name]),
            IF (
                VALUES ( 'Client Name'[Client Name]) = "Others",
                SUMX (
                    TOPN (
                        Rest,
                        ADDCOLUMNS (
                            VALUES ( D_Client[Client Name]),
                            "Measure", [% Cont Client 2020]
                        ),
                        [Measure], ASC
                    ),
                    [Measure]
                )
            )
        )

Top X = 
	VAR TopNumber =if(HASONEVALUE('TopN'[Top N]),VALUES('TopN'[Top N]),20)
    VAR Rest =
        COUNTROWS ( D_Client ) - TopNumber
    RETURN
        IF (
            HASONEVALUE ('Client Name'[Client Name]),
            CALCULATE (
               [% Cont Client 2020],
                FILTER (
                    D_Client,
                    [Client Name] = VALUES ( 'Client Name'[Client Name] )
                        && CONTAINS (
                            TOPN (
                                TopNumber,
                                ADDCOLUMNS (
                                    ALL ( 'Client Name'[Client Name]),
                                    "Contribution", CALCULATE (
                                        [% Cont Client 2020],
                                        FILTER ( D_Client, D_Client[Client Name] = EARLIER ( [Client Name] ) )
                                    )
                                ),
                                [Contribution], DESC
                            ),
                            'Client Name'[Client Name], VALUES ('Client Name'[Client Name] )
                        )
                )
            )
        )

Cualquier ayuda es muy apreciado!

1 REPLY 1
v-easonf-msft
Community Support
Community Support

Hola, @tracytran91
¿Puede compartir datos de muestra detallados para las pruebas?
Es difícil para mí obtener información más útil sólo desde el código.

Saludos
Equipo de soporte de la comunidad _ Eason

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.