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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Calculate a measure depending on value choosen by the slicer

Hi everyone,

I have a table that is giving me the "Down %" for each day. Down means that my production was stopped.

For example, on Day 1, Down% is equal to 0,27. Which means that, because I have 24h in a day, my production was stopped for 0,27*24 = 6,48 hours.

 

On my PBI I had slicers:

Jukotik_0-1713896309368.png

I'd like to calculate a measure that is giving me the number of hours as calculated previously but, for example, when my slicer is selecting a whole week, I'd need to have the average of Down% multiplied by the total of hours in a week. Same for a year for example or just a day and so on. I don't know how I can have a measure that can calculate this based on the selection of my slicers because if it was only one day I could just take Down% * 24hours but the number of hours here depend on what I selected so from 24hours it can be 168 for a week and so on ...

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

To achieve this, you can use a combination of DAX measures that dynamically calculate the total hours based on the slicer selection and then apply the average Down% to this total. Here's a step-by-step approach to create such a measure:

 

Calculate Total Hours: First, you need a measure to calculate the total hours in the selected period. Assuming you have a Date table that is related to your main table, you can create a measure like this:
Total Hours = COUNTROWS('Date') * 24
This measure counts the number of days in your slicer selection and multiplies it by 24 to get the total hours.

 

Calculate Average Down%: Next, you need to calculate the average Down% for the selected period. This can be a simple average measure if you already have Down% calculated for each day:
Average Down% = AVERAGE('YourTable'[Down%])
Replace 'YourTable' with the actual name of your table.

 

Calculate Downtime Hours: Finally, you can calculate the downtime hours by multiplying the Total Hours by the Average Down%:
Downtime Hours = [Total Hours] * [Average Down%]
This measure will dynamically calculate the total downtime hours based on the slicer selection.

 

Please ensure that your slicers are correctly connected to your Date table and that the relationships in your model support these calculations.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

To achieve this, you can use a combination of DAX measures that dynamically calculate the total hours based on the slicer selection and then apply the average Down% to this total. Here's a step-by-step approach to create such a measure:

 

Calculate Total Hours: First, you need a measure to calculate the total hours in the selected period. Assuming you have a Date table that is related to your main table, you can create a measure like this:
Total Hours = COUNTROWS('Date') * 24
This measure counts the number of days in your slicer selection and multiplies it by 24 to get the total hours.

 

Calculate Average Down%: Next, you need to calculate the average Down% for the selected period. This can be a simple average measure if you already have Down% calculated for each day:
Average Down% = AVERAGE('YourTable'[Down%])
Replace 'YourTable' with the actual name of your table.

 

Calculate Downtime Hours: Finally, you can calculate the downtime hours by multiplying the Total Hours by the Average Down%:
Downtime Hours = [Total Hours] * [Average Down%]
This measure will dynamically calculate the total downtime hours based on the slicer selection.

 

Please ensure that your slicers are correctly connected to your Date table and that the relationships in your model support these calculations.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @Anonymous , thanks a lot it's super clear and efficient!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors