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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Rolling Average across the years with blank month

Hello everyone,

 

I am currently developing a chart that need to calculate the rolling average of the counts of events in a monthly basis. The problem that I encountered is my boss would like to have the rolling average reset after a new year. Means if the period I selected is from Jul 2022 to Aug 2023, then the rolling average will calculate from Jul 2022 to Dec 2022 and then started a new calculation from Jan 2023 to Aug 2023 as an example. So the graph will be something look like below.

Junius_1-1691388218785.png

The period of time is based on the drop down selection from a slicer and like a bit dynamic.

 

I have tried to found out a solution to manage it if every month have a event happened, but it is not working probably, if the month doesn't have event. Likle below:

 

 

May I seeks yours help on this question? It will be great if can be resolved and here attached are an example of the data set.

 

Here are some data set for references and as I am not sure how to upload the pbix, so will be great if can let me know how I can upload it here then we can share a bit with yours.

 

Problem occured when I have the slicer to filter by the event type and you can see the blue curve is disconnected.

 

Junius_0-1691396159799.png

 

And this is my rolling average dax.

 

 

 

Rolling average for events = 
IF(
    SELECTEDVALUE('ConsolidateValue'[YearMonth]),
	VAR __LAST_DATE = ENDOFMONTH('ConsolidateValue'[YearMonth].[Date])
	VAR __START_DATE = STARTOFMONTH('ConsolidateValue'[YearMonth].[Date])
    VAR COUNT_PRV_MTH = COUNTAX(FILTER(ConsolidateValue,ConsolidateValue[Year]=MIN(ConsolidateValue[Year])),ConsolidateValue[YearMonth])

    VAR __DATE_PERIOD =
		DATESBETWEEN(
			'ConsolidateValue'[YearMonth].[Date], BLANK(),
			ENDOFMONTH(DATEADD(__START_DATE,COUNT_PRV_MTH-1,MONTH))
            )
	RETURN
		AVERAGEX(
			CALCULATETABLE(
				SUMMARIZE(
					VALUES('ConsolidateValue'),
					'ConsolidateValue'[YearMonth].[Year],
					'ConsolidateValue'[YearMonth].[QuarterNo],
					'ConsolidateValue'[YearMonth].[Quarter],
					'ConsolidateValue'[YearMonth].[MonthNo],
					'ConsolidateValue'[YearMonth].[Month]
				),
				__DATE_PERIOD
			),
			CALCULATE(
				COUNTA(Testing_dataSet[Event Number]), ConsolidateValue[Year]=MIN((ConsolidateValue[Year]))
				
			)
		)
)

 

 

 

And from excel, the table for potting the chart will be like below.

 

Event YearEvent MonthEvent CountsRolling Average
2022Aug11.00
2022Sep00.50
2022Oct10.67
2022Nov00.50
2022Dec00.40
2023Jan00.00
2023Feb00.00
2023Mar10.33
2023Apr10.50
2023May10.60
2023Jun00.50
2023Jul00.43

 

Here below are the dataset that can be used for simulate.

 

Event NumberEvent TypeEvent Caused byEvent StartEvent End
7511436NetworkingN/A2023-07-31T03:38:00Z2023-08-02T20:44:00Z
7443276CollboationN/A2023-07-25T05:30:00Z2023-07-25T08:27:00Z
7290211GlobalN/A2023-07-10T23:59:00Z2023-07-11T01:38:00Z
7275269WebinarN/A2023-07-10T04:53:00Z2023-07-10T10:29:00Z
7183890VoiceN/A2023-06-29T01:37:00Z2023-06-29T11:12:00Z
7139745Vitrual11040072023-06-26T02:00:00Z2023-06-26T07:15:00Z
7142709GlobalN/A2023-06-25T22:33:00Z2023-06-26T04:01:00Z
7142302Communication11436022023-06-25T01:35:00Z2023-06-26T07:30:00Z
6975911VoiceN/A2023-06-07T22:53:00Z2023-06-09T11:30:00Z
6963355VoiceN/A2023-06-07T02:29:00Z2023-06-07T13:46:00Z
6936432VoiceN/A2023-06-04T22:24:00Z2023-06-05T02:18:00Z
6897016MorningN/A2023-06-01T06:32:00Z2023-06-01T14:12:00Z
6886711VoiceN/A2023-05-31T10:52:00Z2023-07-07T13:55:00Z
6884622VoiceN/A2023-05-31T02:00:00Z2023-06-08T02:22:00Z
6884573VoiceN/A2023-05-31T01:35:00Z2023-06-02T03:02:00Z
6714491Webinar9923172023-05-15T06:34:00Z2023-05-15T13:53:00Z
6691884Party10210882023-05-11T21:31:00Z2023-05-13T14:43:00Z
6678908CommunicationN/A2023-05-11T01:15:00Z2023-05-11T08:51:00Z
6643511Global10377762023-05-08T16:58:00Z2023-05-09T02:54:00Z
6548690Webinar8098942023-04-28T02:41:00Z2023-04-28T04:36:00Z
6492845Morning9235442023-04-24T01:55:00Z2023-04-24T03:21:00Z
6397855VoiceN/A2023-04-14T01:26:00Z2023-04-17T02:04:00Z
6316322Interview9183682023-04-06T01:27:00Z2023-04-06T08:42:00Z
6122594InternetN/A2023-03-20T02:02:00Z2023-03-20T04:03:00Z
6068343WebinarN/A2023-03-14T03:19:00Z2023-03-14T09:40:00Z
6011563GameN/A2023-03-09T03:41:00Z2023-03-09T07:43:00Z
5876362In personN/A2023-03-06T08:42:00Z2023-03-06T11:01:00Z
5597976NetworkingN/A2023-03-01T05:16:00Z2023-03-01T16:11:00Z
5459941Communication7200722023-02-20T22:18:00Z2023-02-21T00:48:00Z
5366282VoiceN/A2023-02-10T01:25:00Z2023-02-10T02:50:00Z
5355895EMEAN/A2023-02-09T04:28:00Z2023-02-09T06:09:00Z
5295347TradewebN/A2023-02-02T15:35:00Z2023-02-03T16:06:00Z
5034139LunchN/A2023-01-03T22:47:00Z2023-01-04T02:07:00Z
4929247Vitrual5925322022-12-19T03:38:00Z2022-12-19T06:40:00Z
4791145WebinarN/A2022-12-05T07:44:00Z2022-12-05T16:09:00Z
4697318GameN/A2022-11-22T06:13:00Z2022-11-25T12:34:00Z
4638964Multiple Combination5875412022-11-16T05:47:00Z2022-11-16T07:45:00Z
4625596Global5927892022-11-15T02:14:00Z2022-11-15T03:51:00Z
4520392FinanceN/A2022-11-07T04:08:00Z2022-11-07T08:01:00Z
4556688Beach6418932022-11-02T09:25:00Z2022-11-04T14:36:00Z
4481040Internet6372552022-10-28T02:00:00Z2022-10-28T06:48:00Z
4458501WebinarN/A2022-10-26T01:16:00Z2022-10-26T04:33:00Z
4447627BusinessN/A2022-10-24T23:45:00Z2022-10-26T04:31:00Z
4436019WebinarN/A2022-10-24T04:40:00Z2022-10-24T06:18:00Z
4435733InternetN/A2022-10-24T02:52:00Z2022-10-27T16:17:00Z
4379826Boat TripN/A2022-10-17T21:51:00Z2022-10-18T07:00:00Z
4367838WebinarN/A2022-10-17T03:40:00Z2022-10-17T10:42:00Z
4367782Lunch6092242022-10-17T03:14:00Z2022-10-18T14:05:00Z
4345744Dinner4159912022-10-14T02:21:00Z2022-10-14T07:32:00Z
4216422UnclassifyN/A2022-09-29T00:00:00Z2022-09-29T04:02:00Z
4048593Voice5254362022-09-19T08:19:00Z2022-09-19T09:52:00Z
4124467VoiceN/A2022-09-09T07:04:00Z2022-09-12T23:02:00Z
3981790EMEAN/A2022-08-31T05:23:00Z2022-08-31T08:08:00Z
3938017WebinarN/A2022-08-25T14:06:00Z2022-08-31T17:08:00Z
3925912SemiarN/A2022-08-24T07:32:00Z2022-08-25T02:48:00Z
3904803Asia4916582022-08-22T15:41:00Z2022-08-22T22:01:00Z
3744329WebinarN/A2022-08-04T06:33:00Z2022-08-04T14:53:00Z
3709189GlobalN/A2022-08-01T00:56:00Z2022-08-01T03:41:00Z
3623790WebinarN/A2022-07-21T02:56:00Z2022-07-21T04:23:00Z
3591738WebinarN/A2022-07-18T02:55:00Z2022-07-18T11:14:00Z
3487958AllN/A2022-07-06T01:28:00Z2022-07-06T06:46:00Z

 

Thank you so much!

4 REPLIES 4
Anonymous
Not applicable

Will be great if someone can help on the above? Sorry about my question...

Anonymous
Not applicable

Not sure does anyone have some sort of idea? Maybe that is a bit wired approach, but running out of ideas. Sorry.

mussaenda
Super User
Super User

Hi @Anonymous ,

 

Try changing  your x axis to continuous instead of Categorical, the line will be connected.

Another solution is to add +0 on your formula for the blue line so it will be connected.

 

Hope this helps

Anonymous
Not applicable

Hello Mussaenda,

 

Thanks for yours suggestion, I have already enabled to continous option. However, the problem I think is the calculation is not correct if the rolling average is across two years which will not be reset to a new rolling average after a new year in the selection.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.