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
Syndicate_Admin
Administrator
Administrator

Matrix : Encabezados dobles en matrix visual

¿Cómo puedo lograr el tipo de vista inferior en power bi matrix visual?

Gracias de antemano
MatrixHeaders.jpeg

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

@SK1180 ,

Cree la nueva tabla.

Columns = 
UNION (
    CROSSJOIN ( { "By Product" }, VALUES ( 'Table'[Product] ) ),
    CROSSJOIN ( { "By Year" }, VALUES ( 'Table'[Year] ) ),
    CROSSJOIN (
        { "Summarizations" },
        SELECTCOLUMNS (
            { "Total", "% of Total Sales", "Avg Sale Size" },
            "value2", [Value]
        )
    )
)

vkkfmsft_0-1653895836307.png

A continuación, cree la medida.

MatrixValue = 
VAR ByProduct =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( 'Table', 'Table'[Product] = MAX ( 'Columns'[Sub_header] ) )
    )
VAR ByYear =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER (
            'Table',
            FORMAT ( 'Table'[Year], 0000 ) = MAX ( 'Columns'[Sub_header] )
        )
    )
VAR total = SUM ( 'Table'[Sales] )
VAR totalPercent = total / SUMX ( ALL ( 'Table' ), 'Table'[Sales] )
VAR Avg_ = AVERAGE ( 'Table'[Sales] )
RETURN
    SWITCH (
        MAX ( 'Columns'[Header] ),
        "By Product", ByProduct,
        "By Year", ByYear,
        SWITCH (
            MAX ( 'Columns'[Sub_header] ),
            "Total", total,
            "% of Total Sales", FORMAT ( totalPercent, "Percent" ),
            "Avg Sale Size", FORMAT ( Avg_, ".0" )
        )
    )

vkkfmsft_1-1653895948255.png

vkkfmsft_2-1653895957009.png

Si el problema aún no se resuelve, proporcione información detallada sobre el error o el resultado esperado que espera. Hágamelo saber de inmediato, esperando su respuesta.
Saludos
Winniz
Si esta publicación ayuda, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.

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.