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
DeepDive
Helper IV
Helper IV

Categorías N superiores dinámicas y subes categorias N principales y la marca N superior

Hola a todos, estoy usando debajo del concepto de Curbal para las categorías N principales, pero en categorías tengo subcategorías y bajo subcategorías, también tengo marcas. A nivel individual, todo funciona bien, pero cuando ensobro o expando categorías me muestra correcta para subcategorías, pero para Categorías me da todas las categorías.

Enlace de vídeo de Curbal : https://www.youtube.com/watch?v=SsZseKOgrWQ

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hola, @DeepDive

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

Mesa:

c1.png

Puede crear un parámetro hat-if como se muestra a continuación.

c2.png

Aquí están las columnas y medidas calculadas:

Calculated column:
Level2 = [Category]&"-"&[Sub Category]
Level3 = [Category]&"-"&[Sub Category]&"-"&[Brand]

Measure:
Visual Control = 
var _categorytopn = 
SELECTCOLUMNS(
    TOPN(
        SELECTEDVALUE(Parameter[Parameter]),
        SUMMARIZE(
        ALL('Table'),
        'Table'[Category],
        "Sales",SUM('Table'[Sales])
        ),
        [Sales]
    ),
    "Category",
    [Category]
)
var _subcategorytopn = 
SELECTCOLUMNS(
    TOPN(
        SELECTEDVALUE(Parameter[Parameter]), 
        SUMMARIZE(
            FILTER(
               ALL('Table'),
               'Table'[Category]=SELECTEDVALUE('Table'[Category])
            ),
            'Table'[Category],
            'Table'[Sub Category],
            "Sales",SUM('Table'[Sales])
        ),
        [Sales]
    ),
    "Level2",
    [Category]&"-"&[Sub Category]
)
var _brandtopn = 
SELECTCOLUMNS(
    TOPN(
        SELECTEDVALUE(Parameter[Parameter]),
            SUMMARIZE(
                FILTER(
                    ALL('Table'),
                    'Table'[Category]=SELECTEDVALUE('Table'[Category])&&
                    'Table'[Sub Category]=SELECTEDVALUE('Table'[Sub Category])
                ),
                'Table'[Category],
                'Table'[Sub Category],
                'Table'[Brand],
                "Sales",SUM('Table'[Sales])
            ),     
        [Sales]
    ),
    "Level3",
    [Category]&"-"&[Sub Category]&"-"&[Brand]
)

return
IF(
    ISINSCOPE('Table'[Category])&&NOT(ISINSCOPE('Table'[Sub Category]))&&NOT(ISINSCOPE('Table'[Brand])),
    IF(
        SELECTEDVALUE('Table'[Category]) in _categorytopn,
        1,0
    ),
    IF(
        ISINSCOPE('Table'[Sub Category])&&NOT(ISINSCOPE('Table'[Brand])),
        IF(      
            SELECTEDVALUE('Table'[Category]) in _categorytopn&&
            SELECTEDVALUE('Table'[Level2]) in _subcategorytopn,
            1,0
        ),
        IF(
            ISINSCOPE('Table'[Brand]),
            IF(
                SELECTEDVALUE('Table'[Category]) in _categorytopn&&
                SELECTEDVALUE('Table'[Level2]) in _subcategorytopn&&
                SELECTEDVALUE('Table'[Level3]) in _brandtopn,
                1,0
            )
        )
    )
)

Por último, puede colocar la medida en el filtro de nivel visual y utilizar el parámetro para filtrar el resultado de la parte superior. Dado que el número máximo de 'Marca' es 2, solo hay dos marcas en el nivel 'Marca', aunque la segmentación debanda se establezca como 3. Depende de sus datos.

c3.png

c4.png

c5.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.

Hola @v-alq-msft , Muchas gracias.

Hola Amit, gracias por tu respuesta.

Mi requisito es mostrar YTD en todos los niveles solo para N superior seleccionado usando una sola rebanadora....

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.