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
DavidJ
New Member

Create new table containing the average of another table's column, per category

Hi all,

 

I've spent hours trying to solve this seemingly simple problem and reading previous solutions, which normally works, but this time I just can't find the right answer.

 

I have one table containing a daily percentage for a number of categories:

datecategorydaily percentage
01-JanA76%
02-JanA84%
03-JanA72%
01-JanB23%
02-JanB52%
03-JanB45%
01-JanC50%
02-JanC82%
03-JanC75%

 

I want to create a new table that summarises the average of this percentage, per category

categorysummary percentage
A77.33%
B40%
C69%

 

I've tried a few different solutions but the one below is where I am currently:

 

 

summary table = 
SUMMARIZE(
    SELECTCOLUMNS('table 1',
    "category",
    'table 1'[category],
    "summary_percentage",
    AVERAGE('table 1'[daily percentage])),
    [category],[summary_percentage]
)

 

 

What returns is the average percentage of the total [daily percentage], ignoring the category:

categorypercentage
A62.11%
B62.11%
C62.11%

 

I also created a 'Many to one (*:1)' relationship (Single direction) between the new table and my previous table for [category].

 

Any help would be greatly appreciated! Thank you

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@DavidJ , Create a measure and use that in visual

 

Measure = average(Table[daily percentage])

 

Or new table

table =

Summarize(Table, Table[Category], "Percent", average(Table[daily percentage])  )

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@DavidJ , Create a measure and use that in visual

 

Measure = average(Table[daily percentage])

 

Or new table

table =

Summarize(Table, Table[Category], "Percent", average(Table[daily percentage])  )

Hi @amitchandak - thank you so much! I was just overcomplicating it.

The below worked perfectly. I didn't realise I didn't have to use the SELECTCOLUMNS expression when creating a new table (which I was previous wrapping in the SUMMARIZE expression).

summary table = 
SUMMARIZE(
    'table 1',
    'table 1'[category],
    "summary percentage",
    AVERAGE('table 1'[daily percentage])
)

 

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.