Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Data and filters

Hello, I'm new to power BI. I would like to take a question. How do I filter a date with calculate? Example. Add and filter 01/04/2021?

 

Does not work. Forgive my English.

 

  • Try:

    Lojas ativas1 =
    CALCULATE (
        SUM ( 'Base OMS v2'[Lojas Ativas] ),
        FILTER ( 'Base OMS v2', 'Base OMS v2'[Data] = DATE ( 2021, 04, 01 ) )
    )

3 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Icon for Community Champion rankCommunity Champion

    Try:

    Lojas ativas1 =
    CALCULATE (
        SUM ( 'Base OMS v2'[Lojas Ativas] ),
        FILTER ( 'Base OMS v2', 'Base OMS v2'[Data] = DATE ( 2021, 04, 01 ) )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much. 👍

  • ERD's avatar
    ERD
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous ,

    In terms of your example, usage of VALUE function is incorrect. VALUE converts a text string that represents a number to a number. If your column is of Date type then in this particular example DATE function will help.

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