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

Filtro no afecta a la medida

Hola

Quiero crear una medida para calcular el valor Y-1 basado en el Año seleccionado.

CALCULATE(
SUM(Tabla[Volumns]),
FILTER(ALL(Table), YEAR(Table[Date]) á SELECTEDVALUE('Calendar'[year]) - 1 && Table[Type] á "type1")
)
La medida anterior funciona bien con el valor fijo y no se ve afectada por ningún filtro.
Pero cuando agredo un filtro más -- allselected(Tabla[Categoría]) a este filtro, no puede funcionar.
CALCULATE(
SUM(Tabla[Volumns]),
FILTER(ALL(Table), YEAR(Table[Date]) á SELECTEDVALUE('Calendar'[year]) - 1 && Table[Type] á "type1" && Allselected(Table[Category]))
)
¿Cómo puedo agregar la condición de filtro silcer al formulario?
¡Gracias!
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hola @Icey @amitchandak ,

Gracias por su ayuda.

Lo he arreglado por la función allexcept.

CALCULATE(
SUM('Table'[Volumns]),
PREVIOUSYEAR('Tabla'[Fecha]),
'Tabla'[Tipo] á "tipo1",
ALLEXCEPT('Tabla','Tabla'[Categoría])
)

View solution in original post

3 REPLIES 3
Icey
Community Support
Community Support

Hola @jackwu ,

Prueba esto:

Measure 2 = 
CALCULATE (
    SUM ( 'Table'[Volumns] ),
    FILTER (
        ALLSELECTED( 'Table' ),
        YEAR ( 'Table'[Date] )
            = SELECTEDVALUE ( 'Calendar'[year] ) - 1
            && 'Table'[Type] = "type1"
    )
)

Saludos

Icey

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

Anonymous
Not applicable

Hola @Icey @amitchandak ,

Gracias por su ayuda.

Lo he arreglado por la función allexcept.

CALCULATE(
SUM('Table'[Volumns]),
PREVIOUSYEAR('Tabla'[Fecha]),
'Tabla'[Tipo] á "tipo1",
ALLEXCEPT('Tabla','Tabla'[Categoría])
)
amitchandak
Super User
Super User

@jackwu, ¿quieres año tras año. Si tiene información de tiempo de uso de fecha con tabla de fechas. Si no, entonces tener tabla de años

Con fecha o tabla de año


Este año: CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]-max('Date'[Year])))
Last Year ? CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]-max('Date'[Year])-1))

con tabla de fechas

Ventas YTD á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales á CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Este año Ventas: CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Ventas del año pasado: CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales - CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únete a ella con la columna de fecha de tus hechos. recomienda:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions


Apreciamos tus Felicitaciones.

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.