Forum Discussion

el_astur's avatar
el_astur
Frequent Visitor
6 years ago
Solved

Group by month to average weekly data

Hi all. I'll try to explain it as best i can. I have something like this Not a big deal, its a calendar with day, month, week. (a week can belong to different months) Problem comes when crea...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Weeks are best handled as ISO weeks. Dealing with the usual weeks is messy because they do not go evenly into months and quarters and years.

     

    Here's a measure that returns a weekly average considering only the full 7-day weeks contained in the current period of time.

     

     

    	[Weekly Avg (only full 7 days)] =
    		AVERAGEX(
    			FILTER(
    				// WeekId should uniquely identify
    				// weeks in the calendar.
    				VALUES( Calendar[WeekId] ),
    				CALCULATE(
    					COUNTROWS( 'Calendar' ) = 7
    				)
    			),
    			[Your Measure]
    		)

     

     

    Best
    D