Forum Discussion
LisaB
7 years agoHelper III
Average on distinct values + filter
Hi, I would like to calculate the average value based on distinct values. However, it seems like my filters on page level messes things up: Filters: Status = Active, Item No: 100||200||300 ...
v-yuta-msft
7 years agoCommunity Support
LisaB ,
Firstly, build a relationship between two tables like below:
Secondly, add an index column in table 'Contract invoicing lines', then create a calculate column using DAX below:
Rank = RANKX(FILTER('Contract invoicing lines', 'Contract invoicing lines'[Contract No] = EARLIER('Contract invoicing lines'[Contract No])), 'Contract invoicing lines'[Index], , ASC, Dense)
Finally, create a slicer based on status column and create a measure in 'Contract invoicing lines' table:
Result = CALCULATE(AVERAGE('Contract invoicing lines'[Line Amount]), FILTER('Contract invoicing lines', 'Contract invoicing lines'[Rank] = 1))
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
LisaB
7 years agoHelper III
Hi v-yuta-msft ,
Thanks. Could you, if possible, please explain the functionality of index and what the rank formula does?