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
colourfullife
Post Partisan
Post Partisan

No sumar si no hay ningún valor de fecha

Hola a todos

Necesito tu ayuda.

Tengo este código a continuación.

No quiero sumar la cantidad de la línea de pedido si no hay fechas en CDD

1. CDD ?
VAR _End - CALCULATE ( MAX ( 'SPARES - PO STATUS'[CDD] ), ALL ( 'calendar' ))
devolución
SI (
_End < MIN ( 'calendario'[Fecha] ),
BLANK (),
CALCULATE(
Sum('SPARES - PO STATUS'[PO_LINE_QUANTITY]), USERELATIONSHIP('SPARES - PO STATUS'[CDD],'calendar'[Fecha]),
FILTRO(
ALLSELECTED('calendar'[Fecha]),
('calendario'[Fecha] <-MAX('calendario'[Fecha])))))))
ahora el gráfico se ve divertido como abajo.
aaaasss.PNG
cualquier consejo sería muy apreciado.
Gracias
Cl
7 REPLIES 7
amitchandak
Super User
Super User

@colourfullife , no muy claro, Intente dos modificaciones


CDD ?
VAR _End - CALCULATE ( MAX ( 'SPARES - PO STATUS'[CDD] ), ALL ( 'calendar' ), USERELATIONSHIP('SPARES - PO STATUS'[CDD],'calendar'[Fecha]))
devolución
SI (
_End < MIN ( 'calendario'[Fecha] ) isblank(MAX ( 'SPARES - PO STATUS'[CDD] )),
BLANK (),
CALCULATE(
Sum('SPARES - PO STATUS'[PO_LINE_QUANTITY]), USERELATIONSHIP('SPARES - PO STATUS'[CDD],'calendar'[Fecha]),
FILTRO(
ALLSELECTED('calendar'[Fecha]),
('calendario'[Fecha] <-MAX('calendario'[Fecha])))))))

O


CDD ?
VAR _End - CALCULATE ( MAX ( 'SPARES - PO STATUS'[CDD] ), USERELATIONSHIP('SPARES - PO STATUS'[CDD],'calendar'[Fecha]))
devolución
SI (
_End < MIN ( 'calendario'[Fecha] ) isblank(MAX ( 'SPARES - PO STATUS'[CDD] )),
BLANK (),
CALCULATE(
Sum('SPARES - PO STATUS'[PO_LINE_QUANTITY]), USERELATIONSHIP('SPARES - PO STATUS'[CDD],'calendar'[Fecha]),
FILTRO(
ALLSELECTED('calendar'[Fecha]),
('calendario'[Fecha] <-MAX('calendario'[Fecha])))))))

gracias por su respuesta

Tengo este resultado con ambos códigos

hmm.PNG

Hola @colourfullife,

Tal vez puede romper la relación entre la tabla de hechos y el calendario, a continuación, puede utilizar la fecha del calendario como eje con la siguiente fórmula de medida como valor:

CDD =
VAR _End =
    MAXX ( ALL ( 'SPARES - PO STATUS' ), 'SPARES - PO STATUS'[CDD] )
VAR currDate =
    MAX ( 'calendar'[Date] )
RETURN
    IF (
        currDate <= _End,
        CALCULATE (
            SUM ( 'SPARES - PO STATUS'[PO_LINE_QUANTITY] ),
            FILTER (
                ALLSELECTED ( 'SPARES - PO STATUS' ),
                'SPARES - PO STATUS'[CDD] <= MAX ( 'calendar'[Date] )
            )
        )
    )

Si arriba no ayuda, proporcione algunos datos ficticios con la estructura de la tabla sin procesar, entonces podemos hacer prueba a la fórmula de codificación.

Cómo obtener respuestas a su pregunta rápidamente
saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi,

i think it's not working as i want. 

attached link for dummy file.

dummy file 

 

thank you,

CL

Hola @colourfullife,

No puedo abrir el archivo de ejemplo de mi lado, si el archivo probablemente está cifrado o dañado. ¿Puedes arreglar esto, por favor?

saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hola @v-shex-msft

por favor marque este : ENLACE

saludos

Cl

Hola @colourfullife,

¿Quiere decir que solo desea mostrar el punto de datos sin ningún agregado si los campos de "bacalao" de la tabla de hechos no existen en la tabla de calendario? Si se trata de un caso, puede quitar el operador '<' para mostrar solo el punto de datos en las fechas de calendario correspondientes.

CDD =
VAR _End =
    MAXX ( ALL ( 'SPARES - PO STATUS' ), 'SPARES - PO STATUS'[CDD] )
VAR currDate =
    MAX ( 'calendar'[Date] )
RETURN
    IF (
        currDate <= _End,
        CALCULATE (
            SUM ( 'SPARES - PO STATUS'[PO_LINE_QUANTITY] ),
            FILTER (
                ALLSELECTED ( 'SPARES - PO STATUS' ),
                'SPARES - PO STATUS'[CDD] = MAX ( 'calendar'[Date] )
            )
        )
    )

saludos

Xiaoxin Sheng

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.