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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Summarize by average + filtering on a line chart

I have a data set with the number of registered users on a website, for each day, detailed between male and female users.

 

 

I want to display a line chart showing the evolution of the number of users over time, with drill-down enabled by year+month+day, and the possibility to filter by gender with a slicer. Year and month levels should display an average of the daily values over the period.

 

If I summarize the value by sum, the daily number of users is correct (male + female), but the monthly and yearly numbers are wrong, because Power BI adds up all the daily values.

 

temp.PNG

If I summarize the value by average, the values are always too low, because it is treating male and female values as distinct values and computes the average between them.

 

Can you think of a solution to this problem using Power BI ?

I have already tried various solutions using DAX, but I couldn't find a solution myself.

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

"Year and month levels should display an average of the daily values over the period."

Here's my original data table:

cc9.PNG

 Try this measure:

Measure = 
VAR x = 
CALCULATE(
    COUNT(Sheet12[ registered users]),
    ALLSELECTED(Sheet12[Date])
)
VAR y = 
CALCULATE(
    DISTINCTCOUNT(Sheet12[Date]),
   ALLSELECTED(Sheet12[Date])
)
RETURN
DIVIDE(
    x,y
)

cc8.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

"Year and month levels should display an average of the daily values over the period."

Here's my original data table:

cc9.PNG

 Try this measure:

Measure = 
VAR x = 
CALCULATE(
    COUNT(Sheet12[ registered users]),
    ALLSELECTED(Sheet12[Date])
)
VAR y = 
CALCULATE(
    DISTINCTCOUNT(Sheet12[Date]),
   ALLSELECTED(Sheet12[Date])
)
RETURN
DIVIDE(
    x,y
)

cc8.PNG

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

It is exactly what I needed.

With the small variant that I don't have an individual line for each user, so the COUNT was actually a SUM.

 

But it can be filtered, and works perfectly for all drill-down levels.

 

Thanks a lot.

amitchandak
Super User
Super User

Can you share your current formula, some sample data, current and expected values

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors