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
joelantero
Regular Visitor

Average from KPI column in several tables

Hi,

I'm a beginer in DAX, so have some patience 🙂

 

I have several tables  each one with a KPI column.

I want to create an average from the several tables KPI so I can obtain a unique value from these several KPI's. How can I do this?

 

Is this possible? I already serched for other similar questions, but none give the necesary  knowledge

 

Thanks for you time

 

all the best

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @joelantero,

What's your table structure? Based on mu understanding, I create the following two sample tables. The method is same if you have multiple tables.

TableATableATableBTableB
You want to calcualte the average of the two tables KPI, right? If it is, you create a new table to union all KPI columns in different tables. Please click "New Table"-> under Modeling on Home page , type the formula.

NewTable = UNION(SELECTCOLUMNS(TableA,"KPI",TableA[KPI]),SELECTCOLUMNS(TableB,"KPI",TableB[KPI]))


NewTableNewTable
Then you create a measure based on the KPI in NewTable.

Average = AVERAGEX(ALL(NewTable),NewTable[KPI])


Create a card visual to display the result.

5.PNG


If there are many tables, please use the similar formula.

NewTable = UNION(SELECTCOLUMNS(Table1,"KPI",Table1[KPI]),SELECTCOLUMNS(Table2,"KPI",Table2[KPI]),SELECTCOLUMNS(Table3,"KPI",Table3[KPI]),SELECTCOLUMNS(Table4,"KPI",Table4[KPI]),,,,)


Best Regards,
Angelia

View solution in original post

1 REPLY 1
v-huizhn-msft
Employee
Employee

Hi @joelantero,

What's your table structure? Based on mu understanding, I create the following two sample tables. The method is same if you have multiple tables.

TableATableATableBTableB
You want to calcualte the average of the two tables KPI, right? If it is, you create a new table to union all KPI columns in different tables. Please click "New Table"-> under Modeling on Home page , type the formula.

NewTable = UNION(SELECTCOLUMNS(TableA,"KPI",TableA[KPI]),SELECTCOLUMNS(TableB,"KPI",TableB[KPI]))


NewTableNewTable
Then you create a measure based on the KPI in NewTable.

Average = AVERAGEX(ALL(NewTable),NewTable[KPI])


Create a card visual to display the result.

5.PNG


If there are many tables, please use the similar formula.

NewTable = UNION(SELECTCOLUMNS(Table1,"KPI",Table1[KPI]),SELECTCOLUMNS(Table2,"KPI",Table2[KPI]),SELECTCOLUMNS(Table3,"KPI",Table3[KPI]),SELECTCOLUMNS(Table4,"KPI",Table4[KPI]),,,,)


Best Regards,
Angelia

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.