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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mdbuzzer
Helper I
Helper I

Why is weekly grouping returning wrong dates?

I am creating bins based of my Date field. I created two bins, one which retrieves the daily bins whilst the other bin is to return weekly dates. The daily bins returns the correct dates but the weekly bins is starting from a date which is not even present in my Date field.

How is this happening?

mdbuzzer_1-1603478102985.png

 

mdbuzzer_0-1603478046918.png

My date field starts from October 1st to October 16th, so why is it starting from September 27th?

 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @mdbuzzer ,

 

After my researching, it is by design. Binning splits numeric or date/time data into equally sized groups. If we expand the date range a bit, you will find that October 1, October 2, and October 3 belong to the group beginning on September 27.

 

You could learn more from: 

 

https://dataveld.com/2018/05/10/manual-groups-bins-power-bi/

 

4.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @mdbuzzer ,

 

After my researching, it is by design. Binning splits numeric or date/time data into equally sized groups. If we expand the date range a bit, you will find that October 1, October 2, and October 3 belong to the group beginning on September 27.

 

You could learn more from: 

 

https://dataveld.com/2018/05/10/manual-groups-bins-power-bi/

 

4.png

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mahoneypat
Employee
Employee

That must be the result of the algorithm used to set up the bins.  You can create the week start dates starting on your min date as follows in a column, replacing "Dates" with your actual Date table name.

 

NewBin =
VAR thisdate = Dates[Date]
VAR mindate =
    MIN ( Dates[Date] ) // or use hard coded date like DATE(2020,10,1)
VAR numweeks =
    ROUNDDOWN (
        DATEDIFF (
            mindate,
            thisdate,
            DAY
        ) / 7,
        0
    )
RETURN
    mindate + 7 * numweeks

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


I used that code to create a calculated column and the result was nearly right, but it starts with September 30th rather than October 1st. It should return October 1st, October 7th and October 14th.

 

mdbuzzer_0-1603566374363.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.