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

SELECTEDVALUE no filtra RESUMIÓDCOLUMNS?

hola

Consulte mi modelo de datos de ejemplo: https://www.dropbox.com/s/8s0yto6laccjzh7/Budget%20Type%20Slicer.pbix?dl=0

Tengo dos tablas que contienen presupuestos: HardwareTargets y SoftwareTargets. Necesitan permanecer separados, ya que en mi modelo de datos real son muy diferentes. Ambas tablas contienen una columna BudgetType y una columna Year.

Cuando el usuario selecciona un año de la segmentación de datos Año, quiero que mi segmentación BudgetType solo muestre los BudgetType relacionados con el SELECTEDVALUE of Year en ambas tablas de hechos.

Así que para 2018 eso sería: Presupuesto, Previsión 3+9, Previsión 6+6, Previsión 9+3

Pero para 2019 eso sólo sería: Presupuesto y Previsión 3+9

Por lo tanto, creé una tabla de dimensiones DAX _BudgetTypes, para resumir budgettypes de ambos destinos, en función del año seleccionado y usarlo en mi segmentación BudgetType

_BudgetTypes = 
var __year = 2019
// var __year = SELECTEDVALUE(Dates[Year]) RETURN DISTINCT ( UNION (
        SUMMARIZECOLUMNS (
            HardwareTargets[BudgetType]           
            ,FILTER (
                HardwareTargets,
                HardwareTargets[Año] = __year
            ) ),
        SUMMARIZECOLUMNS (
            SoftwareTargets[BudgetType]
            ,FILTER (
                SoftwareTargets,
                SoftwareTargets[Año] = __year
            ) ) ) ) )
)

Sin embargo, aunque la tabla devuelve los valores apropiados cuando decodifico la variable __year a 2018 o 2019, no funciona si sustituyo el valor codificado de forma rígida por SELECTEDVALUE(Dates[Year]).

¿Alguna idea de por qué? ¿Hay otra solución?

Muchas gracias

marcar

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

No hay @MarkSL

Cree una tabla con la fórmula. Pero la mesa no se puede cambiar dinámicamente por segmentación de datos. Por lo tanto, el valor seleccionado no funcionaría para la tabla. Sólo se podía utilizar en medida dinámica. Para su requisito, puede usar BudgetType en SoftwareTargets o HardwareTargets como segmentación de datos para filtrar la tabla.

https://www.kasperonbi.com/dax-selectedvalue-function/

https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/

saludos

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

No hay @MarkSL

Cree una tabla con la fórmula. Pero la mesa no se puede cambiar dinámicamente por segmentación de datos. Por lo tanto, el valor seleccionado no funcionaría para la tabla. Sólo se podía utilizar en medida dinámica. Para su requisito, puede usar BudgetType en SoftwareTargets o HardwareTargets como segmentación de datos para filtrar la tabla.

https://www.kasperonbi.com/dax-selectedvalue-function/

https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/

saludos

Hola @v-cherch-msft

Gracias por aclarar esto por mí.

Usted dice que para filtrar las tablas presupuestarias que puedo segmentar en BudgetType en SoftwareTargets o HardwareTargets, sin embargo, quiero que una segmentación de datos corte ambas tablas, de ahí por qué fui con la tabla Dax resumida. ¿La solución no requeriría que el usuario tuviera dos segmentaciones de datos, una para cada tabla Targets?

gracias

marcar

No hay @MarkSL

Puede probar la siguiente fórmula para crear la tabla:

_BudgetTypes = 
DISTINCT (
    UNION (
        SELECTCOLUMNS ( HardwareTargets, "Type", HardwareTargets[type] ,"Year",HardwareTargets[Year],"BudgetType",HardwareTargets[BudgetType]),
        SELECTCOLUMNS ( SoftwareTargets, "type", SoftwareTargets[type],"Year",SoftwareTargets[Year],"BudgetType",SoftwareTargets[BudgetType] )
    )

saludos

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.