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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Calculate average based on column values and selected value in slicers

Hi All,

 

I am working on calculating average for one of my dashboard, I want average to be calculated as selected value of slicer.

 

Let say I have one column of product type, another column of location and third is for week. I want my average to be calculated as selected value of this columns in slicer. If i am selecting product type the average will be based on that particular product type only. 

 

Currently I am using below formula:

 

Average OEE_1 = AVERAGEX(VALUES(Deliver_O[ProductType]), AVERAGEX(VALUES(Deliver_O[Location]), AVERAGEX(VALUES(Deliver_O[Week]), CALCULATE('Measure'[Average O]))))
 
This formula helped me in getting average for product type selection, location selection but not in week selection.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi v-kalyj-msft,

 

I am attaching the screenshot of my sample data in excel, When I am using simple average dax formula, I am getting correct results for first two tables in screenshot but when i am selecting multiple location in slicer(washinton+London) the value is not matching.

 

I have attached both screen shot for excel and for PBI also

 

Excel Data.PNGExcelExcelPBIPBI

View solution in original post

5 REPLIES 5
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, I create a sample, Average O is a measure.

vkalyjmsft_0-1657680819758.png

As you say, you want the measure dynamically change by the slicers of ProductType, Location and Week.

However, as the measure created from Sales which is in the same table with the slicers, the measure can aotumatically change by the slicers without do anything. 

vkalyjmsft_1-1657681009506.png

vkalyjmsft_2-1657681026112.png

If this is not the problem, could you please explain it more through my sample. I attach it below for reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please considerAccept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi v-kalyj-msft,

 

I am attaching the screenshot of my sample data in excel, When I am using simple average dax formula, I am getting correct results for first two tables in screenshot but when i am selecting multiple location in slicer(washinton+London) the value is not matching.

 

I have attached both screen shot for excel and for PBI also

 

Excel Data.PNGExcelExcelPBIPBI

Hi @Anonymous ,

What's the formula of OEE measure? Why the average of (0.63264, 0.62643, 0.60761, 0.62469) is not 0.62167.

Best Regards,
Community Support Team _ kalyj

amitchandak
Super User
Super User

@Anonymous , try measure like

 

Average OEE_1 = Switch(selectedvalue(Slicer[value),
"Product Type", AVERAGEX(VALUES(Deliver_O[ProductType]), CALCULATE('Measure'[Average O])),
"Location" , AVERAGEX(VALUES(Deliver_O[Location]), CALCULATE('Measure'[Average O])),
"Week", AVERAGEX(VALUES(Deliver_O[Week]), CALCULATE('Measure'[Average O]))
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Thanks Amit,

 

In first line "slicer" is greyed out for me, I am not sure if I am doing something wrong or not.

 

Those Product type, location in commas are to display something?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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