Forum Discussion
Average - Distinct Count
- 2 years ago
Hi
I resolved this by
- Creating a column in the INS_Main Claim Data table and called it [AverageCountColumn] which placed a number 1 in each row of the table
- Within the same table I created a field called Month_Year which was the Notification Date in the format of
Notification Month Year = FORMAT([NotificationDate]," mmm yyyy")
- I created a measure which calculated a distinctcount of the notification month year:-
Z_Count of Month_Year = (DISTINCTCOUNT('INS_Main Claim Data'[Notification Month Year]))
- I created a measure of the count of the total claim refs:-
z_Generic_No of Claims Distinct = DISTINCTCOUNT('INS_Main Claim Data'[ClaimRef])
- I created an average measure
z_1Average = DIVIDE([z_Generic_No of Claims Distinct],[Z_Count of Month_Year])
- I then created the matrix
- I created the matrix and hid all the average fields apart from the average total
Using a slicer I can now create the a table below which calculates the average based on the number of distinct month year values. I am sure there is a cleverer way to do this using DAX but with my limited knowledge this solution has worked.
Calendar Table
| Date | CalMonth | CalYear | Dateid |
| 03/07/1899 | Jul | 1899 | 18990703 |
| 08/07/1901 | Jul | 1901 | 19010708 |
| 07/07/1902 | Jul | 1902 | 19020707 |
| 06/07/1903 | Jul | 1903 | 19030706 |
| 04/07/1904 | Jul | 1904 | 19040704 |
| 03/07/1905 | Jul | 1905 | 19050703 |
| 08/07/1907 | Jul | 1907 | 19070708 |
| 06/07/1908 | Jul | 1908 | 19080706 |
| 05/07/1909 | Jul | 1909 | 19090705 |
| 04/07/1910 | Jul | 1910 | 19100704 |
| 03/07/1911 | Jul | 1911 | 19110703 |
| 08/07/1912 | Jul | 1912 | 19120708 |
| 07/07/1913 | Jul | 1913 | 19130707 |
| 06/07/1914 | Jul | 1914 | 19140706 |
| 05/07/1915 | Jul | 1915 | 19150705 |
- spandy342 years agoResponsive Resident
Hi
Thank you for the pbix file.
I need an Average Column next to the Total field so will have the following
To include
Total Average
EL 17 1.54 17/ 11 months) = 1.54
IN 5 0.45
ML 25 2.27
MV 5 0.45
OT 5 0.45
PL 6 0.54
PR 4 0.36
Total 67 6.09
- lbendlin2 years agoSuper User
- spandy342 years agoResponsive Resident
The months in the matrix are governed by a slicer so depending how many months are selected will determine how many months the average is divided by so we cant hard code it to 11 as you state in
Average = divide(COUNTROWS('Table'),11,0)for example below when I select 2024-25 financial year we only have April to June . I think its difficult putting an average column in a matrix