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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Create a measure to calculate average by row

Hello everyone, 
I am working with the price of many products and I need to create a measure that shows the average price of them. I have the following table 

"PRESENTACION" are the name of the products, and "WALMART", "FARMACIAS DEL AHORRO", "FARMATODO", "FARMACIAS SAN PABLO" are the name of the columns that contains the prices of each product. 

I need to create a measure that calculates the average of price of the products.

I tried with the average function but it calculates it by row. 

 

What I need to do is like the last screen capture of excel but with a measure in power BI. 

Hope you can help me. 

Thank You.

Sin título.png

 

 

Sin título1.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous  - 

Ideally, you would Unpivot the multiple separate columns into an Amount column and have another column which indicates the store. 

 

As it stands now, you would need to refer to each column within a measure, like this:

Your Measure = 
var Total = SUM(YourTable[Walmart]) + SUM(YourTable[Store2]) + SUM ......
var ValueCount = IF(ISBLANK(SUM(YourTable[Walmart])),0,1) + IF(ISBLANK(SUM(YourTable[Store2])),0,1) + ......
return DIVIDE(Total,ValueCount)

Hope this helps,

Nathan

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@Anonymous  - 

Ideally, you would Unpivot the multiple separate columns into an Amount column and have another column which indicates the store. 

 

As it stands now, you would need to refer to each column within a measure, like this:

Your Measure = 
var Total = SUM(YourTable[Walmart]) + SUM(YourTable[Store2]) + SUM ......
var ValueCount = IF(ISBLANK(SUM(YourTable[Walmart])),0,1) + IF(ISBLANK(SUM(YourTable[Store2])),0,1) + ......
return DIVIDE(Total,ValueCount)

Hope this helps,

Nathan

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors