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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
jondeck24
Advocate II
Advocate II

Time Buckets

Hey All,

 

Had a quick question on how to write a DAX formula to create some time buckets.  So I have a submitted date field in my data that goes back every day for 6 months.  I need to bucket these into 30 days, 30-60 days, and 60+.  The table is application data with various data points and the point is to give #'s as in how many apps have been in the system for 30 days or less, 30-60 days, and how many apps are 60+ days out.  I thought of using Now or Today but am unsure how to reference it off the appsubmitteddate field.

 

Thanks!

2 ACCEPTED SOLUTIONS

One formula you can tweak might be along these lines :

Date Buckets = SWITCH (
INT(divide(now() - int('Dates'[Date].[Date]),30)) ,
0 , "Current" ,
1 ,"30 to 60" ,
2 , "60 to 90" ,
// else ...
"other")


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

v-sihou-msft
Microsoft Employee
Microsoft Employee

@jondeck24

 

In this scenario, to determine which bucket, you should add a column to calculate the variance. You can directly use Table[Date] minus TODAY() as @Phil_Seamark suggested or use DATEDIFF().

 

Variance = DATEDIFF(Table[Date],TODAY(),DAY)

 

Then specify different bucket with above column as condition.

 

Regards,

View solution in original post

3 REPLIES 3
v-sihou-msft
Microsoft Employee
Microsoft Employee

@jondeck24

 

In this scenario, to determine which bucket, you should add a column to calculate the variance. You can directly use Table[Date] minus TODAY() as @Phil_Seamark suggested or use DATEDIFF().

 

Variance = DATEDIFF(Table[Date],TODAY(),DAY)

 

Then specify different bucket with above column as condition.

 

Regards,

Phil_Seamark
Microsoft Employee
Microsoft Employee

I'd suggest building a separate Date table that contains 1 row per date and add columns to this table and creating a relationship.

 

You can build dynamic DAX forumulas to bucket your data as appropriate.

 

A common column to add might be

 

Days from Today = int(dates[date] - now()) 

 

but you can create variations using SWITCH or nested IF statements.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

One formula you can tweak might be along these lines :

Date Buckets = SWITCH (
INT(divide(now() - int('Dates'[Date].[Date]),30)) ,
0 , "Current" ,
1 ,"30 to 60" ,
2 , "60 to 90" ,
// else ...
"other")


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.