Forum Discussion
How to create 7-day bins
Hi,
I need help with the following task.
We have for example a table with orders and date. I need to calculate how many orders were created every week and display that on the chart. The 7-day bins should be created in the following way: the last date of a chosen on a slicer month is our final date, then we go back every 7 days, the last bin will include the days from the previous month such that to complete the whole period of 7 days.
For example, we chose October 2022.
1st bin: 27.09.22 - 03.10.22
2nd bin: 04.10.22 - 10.10.22
3rd bin: 11.10.22 - 17.10.22
4th bin: 18.10.22 - 24.10.22
5th bin: 25.10.22 - 31.10.22
Could you please suggest how this can be implemented.
I tried Power BI bins but it's impossible to implement the above logic.
Many thanks
5 Replies
- rajulshah
Resident Rockstar
You can create bins using the following logic:
This would create bins in the date table. Then you can create another column to get the last date of the week with the following DAX:
WeekLastDate = Dates[Date (bins)] + 6Please let me know if this didn't work.