Forum Discussion
ndna74
9 years agoFrequent Visitor
When to group dates into buckets
Hi
I have a table of loan data in Excel with each transaction having a date. I want to bucket these dates into "less than 3 months", "3-6 months" etc.
I can do this in Excel using IF/AND statements but would it be easier/better practice to do this in Power BI and if so how should I do this?
Many thanks
Nick
1 Reply
- v-yulgu-msft
Microsoft Employee
Hi ndna74,
Please share some sample data to make the requirement more clear. It would be better if you can post the screenshots of sample data and the result of grouping dates into buckets you have achieved in Excel.
Suppose that each transaction has a start date and end date, and you want to group these transactions depend on how long a transaction lasts.
You can add two calculate columns:
Diff = DATEDIFF('group dates'[StartDate],'group dates'[EndDate],MONTH) Group = IF ( 'group dates'[Diff] < 3, "less than 3 months", IF ( 'group dates'[Diff] < 6, "3-6 month", "more than 6 months" ) )Thanks,
Yuliana Gu