Forum Discussion

wiselyman3's avatar
wiselyman3
Helper II
2 years ago
Solved

Count Rows older than 7 days

Hi All, 

 

I am trying to create a visual that shows the number of complaints (rows) that are older than 7 days. Each row has a date in the "Date" column, and this column is formatted as a date. I believe I need to create a measure to put into the visual, but I have not been successful. Below is a sample of the data. So with this example, I would want it to count 3 complaints that are older than 7 days old. Thanks! 

 

 

Table1

Complaint NumberDate
C-1939/20/2023
C-1949/20/2023
C-1959/30/2023
C-19610/01/2023
C-19710/03/2023
  • wiselyman3  Try this measure:

    Num =
    var _v = TODAY()-7
    return
    CALCULATE(COUNT(q5[Complaint Number]), FILTER(q5, q5[Date]<= _v))
     
    P.S. q5 is the name of the table.
     
    Thank You, accept as solution if this helps.

3 Replies

  • wiselyman3  Try this measure:

    Num =
    var _v = TODAY()-7
    return
    CALCULATE(COUNT(q5[Complaint Number]), FILTER(q5, q5[Date]<= _v))
     
    P.S. q5 is the name of the table.
     
    Thank You, accept as solution if this helps.
  • Apologies, this would be 2 complaints older than 7 days in this example. Long day!

  • Dangar332's avatar
    Dangar332
    Resident Rockstar

    hi, wiselyman3 

    try below measure 

     

    COUNTROWS(FILTER(da,CONVERT(TODAY()-'da'[Date],INTEGER)>7))
     
    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.