cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
apurva989
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:

apurva989_1-1629905233512.png

 

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

@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

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

View solution in original post

4 REPLIES 4
amitchandak
Super User
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

https://blog.enterprisedna.co/implementing-80-20-logic-in-your-power-bi-analysis/
https://forum.enterprisedna.co/t/testing-the-pareto-principle-80-20-rule-in-power-bi-w-dax/459

 

 

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

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")
 
Thanks for your help!

@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

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

View solution in original post

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

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors