Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
vnqtrang
Helper I
Helper I

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

2 ACCEPTED SOLUTIONS
v-jingzhang
Community Support
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")

vjingzhang_0-1662429386272.png

vjingzhang_1-1662429597141.png

 

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

View solution in original post

Hi @vnqtrang 

 

Enter a table with Index column. Then sort Created by Index. Sort one column by another column in Power BI - Power BI | Microsoft Docs

vjingzhang_0-1662457952773.pngvjingzhang_1-1662458041098.png

 

Create a relationship between tables on Created column. Then use SortTable's Created column in the table visual instead. 

vjingzhang_2-1662458058780.pngvjingzhang_3-1662458078715.png

 

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

View solution in original post

5 REPLIES 5
v-jingzhang
Community Support
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")

vjingzhang_0-1662429386272.png

vjingzhang_1-1662429597141.png

 

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

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

Hi @vnqtrang 

 

Enter a table with Index column. Then sort Created by Index. Sort one column by another column in Power BI - Power BI | Microsoft Docs

vjingzhang_0-1662457952773.pngvjingzhang_1-1662458041098.png

 

Create a relationship between tables on Created column. Then use SortTable's Created column in the table visual instead. 

vjingzhang_2-1662458058780.pngvjingzhang_3-1662458078715.png

 

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

Thank you  it works as I wish.

 

ryan_mayu
Super User
Super User

@vnqtrang 

could you pls provide the sample data?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.