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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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