Forum Discussion
Help with DAX Average of Distinct Count
Hi floressdiego ,
You can create a measure as below to get it:
Average =
VAR _count =
DISTINCTCOUNT ( 'Colaboradores'[Chave] )
VAR _tab =
SUMMARIZE (
'Colaboradores',
'Colaboradores'[Chave],
"@maxvalsal", MAX ( 'Colaboradores'[valsal] )
)
RETURN
DIVIDE ( SUMX ( _tab, [@maxvalsal] ), _count )
Best Regards
Thanks for the reply.
It worked with filtering the date and with Chave as a Column/Row. If I put another column from the table it doesn't really do.
All I did below was adding codcar, a column from the table (role code), and Chave as rows in a matrix with the columns Average and Admissões.
Chave 584/1/401 is counting twice in Average, but it is not entering the total value, the total is correct. It shouldn't appear below codcar 10/401.
After thinking about it, I don't know if it makes it more clear, I don't know if I need to make another post because maybe it will change the topic slightly, but I think the thought behind this is: I select a month (01/2021), I need the last datalt (date) before or equal the selected date, I need the last altccu ( alteration of center cost, date also) and then I will take the average of valsal (salary) for every Chave I got. (they are all in the same table)
I think this changes a bit, since this is more of some math with the last of each date I got rather than average of a distinct count.
If I need to create another topic, let me know and I will do so...
Thanks