Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Seth4040
Regular 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'))

 

Screenshot 2025-02-25 at 8.30.30 AM.png

Screenshot 2025-02-25 at 8.31.24 AM.png

2 REPLIES 2
adgeku7
Frequent 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]))

 

sanalytics
Super User
Super 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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.