Forum Discussion
Seth4040
1 year agoRegular Visitor
Average based on Filter
I am trying to get the average of project completions per week and then when I am changing the filter as what weeks I am seeing that the average would be tied into this filter. It is currently do the completion average for all the data which is this.
Average = CALCULATE(COUNT('CP Jobs'[Project]),ALL('CP Jobs'))/CALCULATE(DISTINCTCOUNT('CP Jobs'[Year-Wk]),ALL('CP Jobs'))
2 Replies
- sanalyticsSuper User
Seth4040
Can you use below code and see if it is working or not.. if not then requesting you to provide some dummy data along with your desired output.Average Value = VAR FilteredValues = CALCULATETABLE( VALUES(Table[Value]), ALLSELECTED(Table) ) RETURN AVERAGEX(FilteredValues, Table[Value])Regards,
sanalytics
- adgeku7Frequent Visitor
I think the use of ALL() is creating your problem - ALL() ingnores any filters applied at the page or visualization level (example, when you select a week filter, it gets ignored).
Try:
Average = CALCULATE(COUNT('CP Jobs'[Project]))/CALCULATE(DISTINCTCOUNT('CP Jobs'[Year-Wk]))