The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
Solved! Go to Solution.
@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
@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