Forum Discussion

vnqtrang's avatar
vnqtrang
Helper I
3 years ago
Solved

Count data between days

Hi,

 

I have a list of snapshots and the created dates. I would like to have the list (to export) and total of snapshots that were created between > 5d - 10d, >10d - 30d, >30d - 3months, >3 months.

 

createdsnapshot
> 5d - 10d20
>10d - 30d40
>30d - 3months10

>3 months.

4
  
  

 

Thank you in advance.

Tg

  • Hi vnqtrang 

     

    Assume you want to calculate the days between created date and today, you can add a new column similar to below column. Then add a table visual to the report, add Created and Snapshot ID columns to it and select Count aggregation on Snapshot ID. 

    Created = 
    VAR _days = DATEDIFF('Table'[Created Date], TODAY(), DAY)
    RETURN
    SWITCH(TRUE(),
    _days<=5, "<5d",
    _days<=10, ">5d - 10d",
    _days<=30, ">10d - 30d",
    ">30d")

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

5 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi vnqtrang 

     

    Assume you want to calculate the days between created date and today, you can add a new column similar to below column. Then add a table visual to the report, add Created and Snapshot ID columns to it and select Count aggregation on Snapshot ID. 

    Created = 
    VAR _days = DATEDIFF('Table'[Created Date], TODAY(), DAY)
    RETURN
    SWITCH(TRUE(),
    _days<=5, "<5d",
    _days<=10, ">5d - 10d",
    _days<=30, ">10d - 30d",
    ">30d")

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

    • vnqtrang's avatar
      vnqtrang
      Helper I

      HI, 

      Is it possible to filter the option in order of time: 

      <=5d 
      > 5d - 10d 
      >10d - 30d 
      >30d - 3months 

      >3 months.

       

      Because the option "> 5d - 10d" is at the end, i should be below <=5d

       

      Tg