Forum Discussion
jondeck24
9 years agoAdvocate 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 thes...
- 9 years ago
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") - 9 years ago
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,
v-sihou-msft
9 years agoMicrosoft Employee
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,