Forum Discussion

alejandroezp's avatar
alejandroezp
Icon for Helper I rankHelper I
2 years ago
Solved

Problema de fechas en power query

Buenos días,

 

Estoy probaundo a crear una query en Power BI y me responde error.

Mi intención es sacar un conteo de celdas distintas que pertenezcan a un rango de fechas de una tabla. 

Tengo una tabla, la cual se actualiza todos los meses, con una columna que indica la fecha en que se añadió cada fila. Quiero extraer el número de filas que hay dentro de un período de tiempo y que no cuente las filas duplicadas.

Esta es la query que estoy probando:

Total Ventas-S2 = CALCULATE(DISTINCTCOUNT('Ventas'[id]),FILTER('Ventas',('Ventas'[Fecha] = DATESBETWEEN(Calendario[Date],DATE(2023, 1, 1),DATE(2023, 6, 1)))))
 
Saludos
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi alejandroezp 

    If your calendar table have the relationship with yourr ventas table,You can try the following measure

    Total Ventas-S2 =
    CALCULATE (
        DISTINCTCOUNT ( 'Ventas'[id] ),
        DATESBETWEEN ( Calendario[Date], DATE ( 2023, 1, 1 ), DATE ( 2023, 6, 1 ) )
    )
    

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi alejandroezp 

    If your calendar table have the relationship with yourr ventas table,You can try the following measure

    Total Ventas-S2 =
    CALCULATE (
        DISTINCTCOUNT ( 'Ventas'[id] ),
        DATESBETWEEN ( Calendario[Date], DATE ( 2023, 1, 1 ), DATE ( 2023, 6, 1 ) )
    )
    

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.