Forum Discussion

Oros's avatar
Oros
Post Prodigy
1 year ago
Solved

COUNT with FILTER based on dates

Hello,
 
I have the following measure that works based on the Date column.  The Date column did not have any value yet.
 
Number of books = (COUNT(Books-Table[Date]) + 0)
 
Now that the Date column already has different date values, what would be the correct measure to count ONLY the ones with the date of September 10, 2024?  In other words, COUNT based on fil
 
Thanks.
  • You could try this:

    Number of books = CALCULATE ( COUNT (Books-Table[Date]), Books-Table[Date] = "9/10/2024" )

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi,

    Thanks for the solution ToddChitt  offered,and i want to offer some more information for user to refer  to.

    hello Oros , you can try the following measure.

    Number of books =
    COUNTROWS ( FILTER ( Books - Table, [Date] = DATE ( 2024, 9, 10 ) ) )
    

    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.

     

  • Oros's avatar
    Oros
    1 year ago

    Hi Anonymous,

     

    Thanks a lot.  It works! 

7 Replies

  • You could try this:

    Number of books = CALCULATE ( COUNT (Books-Table[Date]), Books-Table[Date] = "9/10/2024" )

    • Oros's avatar
      Oros
      Post Prodigy

      Hi ToddChitt ,

       

      Thank you for your quick reply. 

       

      Unfortunately, I am getting an error:

      "Column 'Date' in table 'Books-Table' cannot be found or may not be used in this expression."

    • Oros's avatar
      Oros
      Post Prodigy

      Hi ToddChitt ,

       

      Sorry...I missed one character.  There was no error in the measure.  Just this one.  Any idea? Thanks again.

       

      • ToddChitt's avatar
        ToddChitt
        Super User

        Can you show an example of the data you have, and the expected result of the calculation?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    Thanks for the solution ToddChitt  offered,and i want to offer some more information for user to refer  to.

    hello Oros , you can try the following measure.

    Number of books =
    COUNTROWS ( FILTER ( Books - Table, [Date] = DATE ( 2024, 9, 10 ) ) )
    

    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.

     

    • Oros's avatar
      Oros
      Post Prodigy

      Hi Anonymous,

       

      Thanks a lot.  It works!