cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

## Average per category and date

Hi all. I think this was already discussed but none of the topic solutions seem to work for me.

I am looking for a measure (wonder if possible to have a calculated column version as well? ) which would calculate average value per category (in my example C1, C2, C3, C4) and date. I am using line and clustered line chat visual. What I got so far it gives me the average value but it does not mind that some months have only 3 categories. So for the 2020-07 I expect average value to be 6.

3 REPLIES 3
Solution Sage

You probably mean: "...that returns the average over the selected/visible categories for any selected period of time." Right? "An average value per category" means, according to my understanding, that you'd want to calculate an average (over something, maybe days) for any specific category.

Here's a possible measure...

``````[Average Over Categories] =
calculate(
averagex
distinct( T[Category] ),
[your_measure_here]
),
allselected( T )
)``````
Anonymous
Not applicable

@daxer-almighty might be you're more accurate though I thought date might also be category 🙂 in any case - if you have any suggestions would appreciate.

Solution Sage

@Anonymous

Well, you can't write a measure that does everything. You have to clearly define what type of average you want since it's not possible to have a measure that averages over several different entities. So, you can have an average over time or over categories. You can't have one that averages over categories or/and time. How would you then know which average to take if both categories and time are present in the visual? Of course, you could specify a rule to say when each type of average you'd like to see but... nobody does such logical stunts as it would be very hard to interpret/remember and read by the end users. So, either an average over categories or over time. Tertio non datur.

A possible measure is above...

Announcements

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

#### Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

#### Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors