cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Frequent Visitor

## First occurrence in a measure

Hi folks,

I've been scratching my head over this issue and read through multiple forum posts but nothing has helped me so far. Sample data below:

I have four fields here:

Index - unsummarized column from my source (column)

Wafer Sum = Summarized column

Cumulative Sum = Running total of Wafer Sum per Index column (Quick Measure)

Flag = Toggles between Yes and No based on following condition ( [Cumulative Sum] >= [Wafer Sum] * 0.5) (Measure)

What I'm trying to accomplish is get the first occurrence when the Flag = "Yes" and return the Index value. In this case, the Index value returned should be 25. However, I cant use most of the functions such as EARLIER, MINX or CALCULATE since they are catered towards columns and not measures.

Any help on this issue is appreciated. Thanks in advance!

1 ACCEPTED SOLUTION
Super User

@apurva989 , based on this   ( if ([Cumulative Sum] >= [Wafer Sum], "Yes","No") ) ,  it should be like

minx(filter(values(Table[Index]), [Cumulative Sum] >= [Wafer Sum] ), [index])

You yes condition should be in the filter

4 REPLIES 4
Super User

@apurva989 , Try a measure like

minx(filter(values(Table[Index]), [Cumulative Sum] >= [Wafer Sum] * 0.5), [index])

Or are you looking for percentile?

example

Frequent Visitor

Hey @amitchandak Almost there!

Your formula does give me an index value but I'm looking for the first index value where the flag is yes. The value I'm getting right now is Index = 2. Should be 25. No percentile, just a plain lookup against the index column.

The flag measure I created is using the following formula:

if ([Cumulative Sum] >= [Wafer Sum], "Yes","No")

Super User

@apurva989 , based on this   ( if ([Cumulative Sum] >= [Wafer Sum], "Yes","No") ) ,  it should be like

minx(filter(values(Table[Index]), [Cumulative Sum] >= [Wafer Sum] ), [index])

You yes condition should be in the filter

Frequent Visitor

Thanks! I got the correct answer after I added the underlying filters 🙂

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors