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.
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) | Incident | Incident Type |
2018/Oct | Inc 1 | Type 1 |
2018/Oct | Inc 2 | Type 2 |
2018/Nov | Inc 3 | Type 4 |
2018/Dec | Inc 4 | Type 7 |
2018/Dec | Inc 5 | Type 1 |
2018/Dec | Inc 6 | Type 3 |
2019/Jan | Inc 7 | Type 6 |
2019/Jan | Inc 8 | Type 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 Type | 2018/Oct | 2018/Nov | 2018/Dec | 2019/Jan | 2019/Feb | 2019/Mar | 2019/Apr | 2019/May | 2019/Jun | 2019/Jul | Grand Total | Average |
Type 1 | 2 | 2 | 2 | 4 | 3 | 3 | 3 | 3 | 4 | 1 | 27 | 2.7 |
Type 2 | 5 | 2 | 1 | 1 | 1 | 8 | 2 | 5 | 6 | 31 | 3.4 | |
Type 3 | 2 | 1 | 1 | 2 | 1 | 7 | 1.4 | |||||
Type 4 | 10 | 4 | 4 | 10 | 8 | 9 | 3 | 10 | 4 | 62 | 6.9 | |
Type 5 | 3 | 3 | 3.0 | |||||||||
Type 6 | 1 | 3 | 4 | 2 | 2 | 2 | 14 | 2.3 | ||||
Type 7 | 5 | 12 | 5 | 6 | 4 | 4 | 3 | 1 | 1 | 41 | 4.6 | |
Type 8 | 1 | 2 | 1 | 1 | 3 | 2 | 6 | 2 | 18 | 2.3 | ||
Type 9 | 1 | 1 | 2 | 4 | 1.3 | |||||||
Type 10 | 1 | 1 | 1 | 1 | 4 | 1.0 | ||||||
Total | 26 | 27 | 19 | 23 | 17 | 15 | 26 | 16 | 26 | 16 | 211 | 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
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
Refer
https://community.powerbi.com/t5/Desktop/Average-count-per-month-per-id/td-p/212988
https://community.powerbi.com/t5/Desktop/SUM-of-AVERAGE/td-p/197013
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |