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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
acg
Resolver I
Resolver I

Create a measure of a measure: when greater than x then 1 else 0

Hi 

 

I have some IDs for which I calculated the average time worked. 

 

Average overtime looks simply like this:

Average Overtime worked=
AVERAGE(timesheet[Weekly_OverTimeHours])
 
How can I create a new measure called 
Indicator= when [Average Overtime worked] > 5 then 1 else 0 ?
 
I know I could use the filter, but I need to have Indicator to create a visual subsequently. 

 

IDAverage Overtime workedIndicator
127381
447640
562361
223350
442371
1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @acg ,

The [Margin Type] formula you have created could not be used as a calculated table, it should be a measure or a calculated column.

 

Measure:

Margin Type = 
IF(
    [Average overtime worked] > 5,1,0
)

Calculated column:

Margin Type column =
VAR _avg =
    CALCULATE (
        AVERAGE ( timesheet[Weekly_OverTimeHours] ),
        ALLEXCEPT ( 'timesheet', timesheet[ID] )
    )
RETURN
    IF ( _avg > 5, 1, 0 )

vyingjl_0-1634262517280.png

Best Regards,
Community Support Team _ Yingjie Li
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

6 REPLIES 6
amitchandak
Super User
Super User

@acg , Create a new table like Indicator with values 1,0 and use that as slicer

 

Now create a measure like

calculate([Average Overtime worked]. filter(Values(Table[ID]), [Indicator] = max(Indicator[Indicator])))

 

 

Refer this, if needed

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Does this also work for numeric outcomes? 0/1 needs to be numeric so that it can be used later on for some calculations / visuals, where the indicator needs to be counted. 

Great @amitchandak

 

I see you create the buckets and that is how you create the indicator. 

So I created this as in:

Margin Type =
SWITCH(TRUE(),
[AVG OT Measure] > 5, 1,
[AVG OT Measure] = 5, 1,
[AVG OT Measure] <5, 0)
 
But it says: The expression specified in the query is not a valid table expression.
 
Why would that be? THe indivator 0/1 needs to be numeric, so it can be used later on. 
v-yingjl
Community Support
Community Support

Hi @acg ,

The [Margin Type] formula you have created could not be used as a calculated table, it should be a measure or a calculated column.

 

Measure:

Margin Type = 
IF(
    [Average overtime worked] > 5,1,0
)

Calculated column:

Margin Type column =
VAR _avg =
    CALCULATE (
        AVERAGE ( timesheet[Weekly_OverTimeHours] ),
        ALLEXCEPT ( 'timesheet', timesheet[ID] )
    )
RETURN
    IF ( _avg > 5, 1, 0 )

vyingjl_0-1634262517280.png

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @

PREVIEW
 
 
 

Hi @acg , any luck with the last part of your problem? I am trying to solve the exact same scenario as you were.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.