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

Dos valores en una fila en matriz

Buenos días
Tengo una situación como esta:

tarz_0-1606892307367.png

y lo estoy replicando como una matriz.
Pero me preguntaron si puedo cambiar la opinión a esto:

tarz_1-1606892320262.png

¿cómo puedo poner dos valores en un campo alineado en el centro?

o, si no puedo hacer lo anterior, me gustaría poder replicar una situación como esta:

tarz_2-1606892333747.png

¿Cómo puedo poner un espacio antes del nombre del campo?

gracias a todos por la ayuda

Saludos

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hola, @tarz

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

Mesa:

c1.png

Kpi:

c2.png

A continuación, debe hacer 'KPI1', 'KPI2', 'KPI3' seleccionados y despivos ellos.

c3.png

No hay ninguna relación entre tablas. Puede crear una medida como se indica a continuación.

Result = 
var t = 
ADDCOLUMNS(
    CROSSJOIN(
        DISTINCT('KPI'[New KPI]),
        DISTINCT('Table'[Year])
    ),
    "Result",
    IF(
        [New KPI]="KPI1",
        CONCATENATEX(
            FILTER(
                ALL('Table'),
                [KPI] in {"KPI1","KPI2"}&&
                [Year]=EARLIER('Table'[Year])
            ),
            [Value],
            UNICHAR(10)
        ),
        CONCATENATEX(
            FILTER(
                ALL('Table'),
                [KPI]=EARLIER('KPI'[New KPI])&&
                [Year]=EARLIER('Table'[Year])
            ),
            [Value],
            UNICHAR(10)
        )
    )
)
return
CONCATENATEX(
    t,
    [Result],
    UNICHAR(10)
)

Resultado:

c4.png

Saludos

Allan

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

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hola, @tarz

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

Mesa:

c1.png

Kpi:

c2.png

A continuación, debe hacer 'KPI1', 'KPI2', 'KPI3' seleccionados y despivos ellos.

c3.png

No hay ninguna relación entre tablas. Puede crear una medida como se indica a continuación.

Result = 
var t = 
ADDCOLUMNS(
    CROSSJOIN(
        DISTINCT('KPI'[New KPI]),
        DISTINCT('Table'[Year])
    ),
    "Result",
    IF(
        [New KPI]="KPI1",
        CONCATENATEX(
            FILTER(
                ALL('Table'),
                [KPI] in {"KPI1","KPI2"}&&
                [Year]=EARLIER('Table'[Year])
            ),
            [Value],
            UNICHAR(10)
        ),
        CONCATENATEX(
            FILTER(
                ALL('Table'),
                [KPI]=EARLIER('KPI'[New KPI])&&
                [Year]=EARLIER('Table'[Year])
            ),
            [Value],
            UNICHAR(10)
        )
    )
)
return
CONCATENATEX(
    t,
    [Result],
    UNICHAR(10)
)

Resultado:

c4.png

Saludos

Allan

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

AllisonKennedy
Super User
Super User

¿Cómo están los datos sin procesar? ¿Está todo en una mesa? ¿Tiene una tabla Categoría que muestra que KPI 1 y KPI 2 forman parte de la misma categoría? Si tiene esto, podría usar el diseño escalonado en matriz en Desactivado y establecer Categoría y KPI como filas.

Por ejemplo, agregue una tabla como:

Categoría Kpi
A KPI 1
A KPI 2
B KPI 3

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

@AllisonKennedy thnak for your answer. I have this situatione in my table:

tarz_0-1606908087938.png

 

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.