Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Filtro de fecha no funciona

Hola, tengo un problema para crear una medida sobre un informe. El informe es una tabla larga en la que represento algunos valores de almacén día a día (consulte la captura de pantalla).

mag.PNG

Estoy tratando de insertar en una medida un filtro de fecha en el que digo (para cada fila del informe):

F - Inventario[Hora de fecha creada] <- (la fecha de campo en el informe, que se toma de un campo de la tabla dimensional D - Fecha[Fecha]).

Lo intenté de esta manera:

NUEVO En Acq Vib Spe - CALCULATE
(
SUMX('F - Inventario','F - Inventario'[Cantidad]*'F - Inventario'[Coste unitario]),
'F - Inventario'[Tipo de transacción]-"Ordine fornitore",
'D - Almacén'[ID de almacén]-"B0",
'D - Elemento'[Tipo]-"Elemento",
'D - Item'[Unified Special]'"Special",
'F - Inventario'[Fecha de inventario]"1900-01-01" ? 'F - Inventario'[Fecha de inventario]>'D - Fecha'[Fecha],
'F - Inventory'[Status ID] EN "StatusReceipt-3", "StatusReceipt-4", "StatusReceipt-5",
'F - Inventario'[Hora de fecha creada]<'D - Fecha'[Fecha]
)
Pero no está funcionando. ¿Cuál es la sintaxis correcta para incluir en la fórmula?
4 REPLIES 4
AntrikshSharma
Community Champion
Community Champion

En primer lugar, debe comprender que está utilizando 2 columnas en una operación booleana.

'F - Inventario'[Hora de fecha creada] en 'F - Inventario'[Hora de fecha creada]<'D - Fecha'[Fecha] se expande a

FILTER ( ALL ( 'F - Inventory'[Created Date Time] ), SomeCondition )

Ahora usted está tratando de obtener fechas que están en otra tabla, eso no está permitido porque FILTER & ALL contruct sólo tiene una columna. y lo mismo es cierto para:

'F - Inventory'[Inventory date]="1900-01-01" || 'F - Inventory'[Inventory date]>='D - Date'[Date],

¿Está tratando de calcular un total rodante? si es así, podría usar:

NEW In Acq Vib Spe =
VAR LastAvailableDate = MAX ( 'D - Date'[Date] )
VAR Result =
    CALCULATE (
        SUMX ( 'F - Inventory', 'F - Inventory'[Quantity] * 'F - Inventory'[Unit Cost] ),
        'F - Inventory'[Transaction type] = "Ordine fornitore",
        'D - Warehouse'[Warehouse ID] = "B0",
        'D - Item'[Type] = "Item",
        'D - Item'[SpecialUnificato] = "Speciale",
        'F - Inventory'[Inventory date] = "1900-01-01"
            || 'F - Inventory'[Inventory date] >= LastAvailableDate,
        'F - Inventory'[Status ID]
            IN { "StatusReceipt-3", "StatusReceipt-4", "StatusReceipt-5" },
        FILTER ( ALL ( 'D - Date'[Date] ), 'D - Date'[Date] <= LastAvailableDate )
    )
RETURN
    Result
amitchandak
Super User
Super User

@Hydrarian , Probar como

NEW In Acq Vib Spe = CALCULATE
(
SUMX('F - Inventory','F - Inventory'[Quantity]*'F - Inventory'[Unit Cost]),
,
'D - Warehouse'[Warehouse ID]="B0",
'D - Item'[Type]="Item",
'D - Item'[SpecialUnificato]="Speciale",
Filter('F - Inventory','F - Inventory'[Transaction type]="Ordine fornitore" && ('F - Inventory'[Inventory date]="1900-01-01" || 'F - Inventory'[Inventory date]>='D - Date'[Date]) && 'F - Inventory'[Status ID] IN { "StatusReceipt-3", "StatusReceipt-4", "StatusReceipt-5"}  
&& 'F - Inventory'[Created Date Time]<='D - Date'[Date])
)
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hola, he probado su solución, pero el problema es que no puedo insertar 'D - Fecha'[Fecha]. Si empiezo a escribir me sugiere sólo medidas, mientras que 'D - Fecha'[Fecha] es un campo.

tex628
Community Champion
Community Champion

Parece que está comparando el tipo de fecha con el tipo de cadena. En lugar de usar "1900-01-01", utilice DATE(1900,1,1).

Br
J


Connect on LinkedIn

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors