Forum Discussion
Lookupvalue only first result
- 8 years ago
You should use EARLIER() in your filter:
Column = CALCULATE ( FIRSTNONBLANK ( Table4[Column C], TRUE () ), FILTER ( Table4, Table4[Column A] = 1 && Table4[Column B] = EARLIER ( Table4[Column B] ) ) )Regards,
You can try the FIRSTNONBLANK function instead of LOOKUPVALUE. This would look like:
CALCULATE( FIRSTNONBLANK(ColumnC, TRUE()), FILTER(Table, ColumnA = ColumnB) )
Hello
I tried what u said and used
=CALCULATE(
FIRSTNONBLANK('Table'[Column C]; TRUE());
FILTER('Table';'Table'[Column A]=1);
FILTER('Table';'Table'[Column B]='Table'[Column B])
)It works half. It ignores kinda the second Filter, so the output currently is "P 1" for every line. If i replace the second 'Table'[Column B] with the actual Value of the Row (e.g. 99 for the first row, 88 for the second one...) it shows the correct value.
Any other Ideas?
- v-sihou-msft8 years agoMicrosoft Employee
You should use EARLIER() in your filter:
Column = CALCULATE ( FIRSTNONBLANK ( Table4[Column C], TRUE () ), FILTER ( Table4, Table4[Column A] = 1 && Table4[Column B] = EARLIER ( Table4[Column B] ) ) )Regards,
- Aroc8 years agoFrequent Visitor
This works perfect, thank you very much
- RaulRG6 years agoFrequent Visitor
Hi, All
I have used this approach and it is partly working for me. I would like to extract the the value of the column Z_result by filtering in Variable 1 and Variable 2 (first value of Z_Results when the values of Variable 1 and Variable 2 are equal).
By using FIRSTNONBLANK function, I am not getting what I want (see Unique ID 7 and 8 in the attached picture).
The attached pic is just an oversimplication of a much more complex set of data with 1000s of rows
Thanks for your help
------------------------------
ZZ_First Occurence =CALCULATE (FIRSTNONBLANK(Sheet1[Z_Resul],TRUE()),FILTER (Sheet1,Sheet1[Variable 1] = EARLIEr ( Sheet1[Variable 1] )&& Sheet1[Variable 2] = EARLIEr ( Sheet1[Variable 2] ) )) - TAMOREIRA6 years agoFrequent Visitor
I am working on a patient flow projected and was having such a hard time looking up the earliest date of a consult based on patient number and visit code (consult vs. treatment vs. simulation). This solution worked for me! Thank you so much.