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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
badger123
Resolver I
Resolver I

Average of category for timeseries

Hello! I'm looking for some help with the following please:

 

I have a simple table (see below snippet) which I'm using to plot a line chart at a country level, e.g. US - so summing up the values for all the regions. The item_id is linked to another table which has more info on that item, including category (A,B,C,D,E). I would like to create a measure to display another line in my chart, basically the average of the values at each point in time for all items in category A

 

item_idregion_iddatevalue
51340821USAL2014-12-01 00:00:00590
51340821USAK2014-12-01 00:00:0090
51340821USAZ2014-12-01 00:00:001300
51340821USAR2014-12-01 00:00:00260
51340821USCA2014-12-01 00:00:0014800
51340821USCO2014-12-01 00:00:001000
51340821USDE2014-12-01 00:00:00210
51340821USDC2014-12-01 00:00:00720
51340821USFL2014-12-01 00:00:004400

 

Any help would be appreciated greatly!! 🙂 

2 ACCEPTED SOLUTIONS
v-chuncz-msft
Community Support
Community Support

@badger123,

 

You may simply try AVERAGEX and FILTER.

Community Support Team _ Sam Zha
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

Thanks, this measure seemed to work:

 

 

 

Average_of_selected_category=
VAR ItemCategory=
SELECTEDVALUE ( 'Table1'[category] )
RETURN
CALCULATE(
AVERAGEX('Table2','Table2'[value]),
FILTER(ALL('Table1'[category]),'Table1'[category]=ItemCategory))
 

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@badger123,

 

You may simply try AVERAGEX and FILTER.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, this measure seemed to work:

 

 

 

Average_of_selected_category=
VAR ItemCategory=
SELECTEDVALUE ( 'Table1'[category] )
RETURN
CALCULATE(
AVERAGEX('Table2','Table2'[value]),
FILTER(ALL('Table1'[category]),'Table1'[category]=ItemCategory))
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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