Forum Discussion
vemee
2 years agoRegular Visitor
Help calculating simpson's diversity index
Hi, I am rather new to Power BI, and would be truly greatfull for some help. I would like to calculate the simpson's diversity index based on the data avaliblie in my report. The calculation is ra...
- Anonymous2 years ago
Hi vemee ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create a calculate columnSimpson's Diversity Index = VAR Total_Observations = COUNTROWS('Table') VAR Value_Occurrences = CALCULATE( COUNTROWS('Table'), FILTER('Table', 'Table'[Colors] = EARLIER('Table'[Colors]) ) ) RETURN 1 - SUMX('Table',Value_Occurrences * (Value_Occurrences-1)) / (Total_Observations * (Total_Observations - 1))Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Syndicate_Admin
Administrator
2 years agoHola Ville,
Podés probar:
Simpson_Index =
VAR TotalCount = SUM('Species'[Count])
RETURN
DIVIDE(
SUMX('Species', 'Species'[Count] * ('Species'[Count] - 1)),
TotalCount * (TotalCount - 1) )