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
Anonymous
Not applicable

DAX for average of monthly count

Hey Power BI aficionados

 

So I have data set that looks something like the below (this is not the complete data set):

 

Date (Year/Month)IncidentIncident Type
2018/OctInc 1Type 1
2018/OctInc 2Type 2
2018/NovInc 3Type 4
2018/DecInc 4Type 7
2018/DecInc 5Type 1
2018/DecInc 6Type 3
2019/JanInc 7Type 6
2019/JanInc 8Type 2

 

What I'm trying calculate via DAX is the average of count of incidents per incident type per month. For Eg: Averge number of incidents for the incident type Type 6 between the period 2018/Oct and 2019/Jul is calculated in the below table as (1+3+4+2+2+2)/6 = 2.3 (each of the cell value in the below table corresponds to the count of incidents per incident type per month). I'd like to be able to calculate the average of count for last 'n' months, for instance if we were in Jan 2020 and I'd like the DAX to calculate last 10 months average (n = 10).

 

Incident Type2018/Oct2018/Nov2018/Dec2019/Jan2019/Feb2019/Mar2019/Apr2019/May2019/Jun2019/JulGrand TotalAverage
Type 1222433334127          2.7
Type 25211 1825631          3.4
Type 321  121   7          1.4
Type 41044108 9310462          6.9
Type 5     3    3          3.0
Type 6134  222  14          2.3
Type 75125644 31141          4.6
Type 81211  326218          2.3
Type 9  1 1    24          1.3
Type 10 111   1  4          1.0
Total26271923171526162616211        21.1

 

Please let me know if you'd like any more info or if any of this isn't clear.

 

Thanks in advance for your help.

 

Cheers

2 REPLIES 2
Icey
Community Support
Community Support

Hi @Anonymous ,

 

If you don't mind, please share me as much sample data as possible, without real data or sensitive information. I will conduct specific tests.

 

 

Best Regards,

Icey

amitchandak
Super User
Super User

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.