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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MPereira
Frequent Visitor

How to search a value in the same column

Hi experts... I need your help.

 

I have a quality database of my products where one of my information is the LOTE.
In my quality process I can disapprove a complete LOTE (mother lote), or simply part of the LOTE (Children Lote).

 

My scenery.png                          


I identify a Mother Lote when the code does not have the hyphen (-) and the first 14 characters are the same as the first 14 characters of the child Lote.

 

In that case, when I reject the Mother Lote, I need to disregard the child lotes from my analysis. For example:

          Captura de Tela 2018-12-12 às 17.08.20.png

 

I tried several ways to mark these children lotes with some flag, but I could not find a correct way to do this programming.


Anyone have any idea how to do it?

1 ACCEPTED SOLUTION

@MPereira

 

Try this for your calculated column. Bear in mind that I am assuming here that IDs for Mother Lotes always have 14 characters and IDs for Children Lotes always 17 as you show.

 

Table1[Delete] = 
VAR IsChildrenLote = (LEN(Table1[Lote])=17)
RETURN
IF(IsChildrenLote;
     IF(CONTAINS(Table1;Table1[Lote];MID(Table1[Lote];1;14));"X")
)

 

View solution in original post

13 REPLIES 13
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @MPereira,

Based on my test, you could refer to below steps:

Sample data:

1.PNG

Create below calculated columns:

a = IF(LEN('Table1'[Lote])=14,'Table1'[Lote],BLANK())
b = IF(LEFT('Table1'[Lote],14)=MAX('Table1'[a])&&'Table1'[a]=BLANK(),"X",BLANK())

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

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

Hi Daniel,
Thanks for your reply!
For example data I used your solution works perfectly, however were just examples.
When I use a larger data mass, this solution does not work correctly.
Any new suggestions?
thank you,

Marcelo.

AlB
Super User
Super User

Hi @MPereira

Where in your table(s) can you see whether a mother lote is rejected?  

MPereira
Frequent Visitor

Hi AIB.

 

The mother lote is never rejected.
Whenever a mother lote appears in my data, I should automatically delete the children lotes.

Ok?

 

tks,

Marcelo.

Hi @MPereira

 

If @v-danhe-msft's solution works perfectly with the sample data you posted but not with the other data you are trying I guess you should either provide a sample of the new data that is representative of the differences with the one posted (best option) or explain what the differences are. Otherwise we cannot help much.

MPereira
Frequent Visitor

Hi @AlB!

 

f course yes!
Following is a file with a larger mass of data than the initial example.

Captura de Tela 2018-12-14 às 16.01.28.png

 

Thank you for your help.

 
 

Ok @MPereira

But could you share, rather than a screen capture, either the file itself (preferably) or otherwise paste the data here in text format, so that it can be easily copied? You can copy a table (or fragment thereof) and paste it in the editor where you write your message

Thanks   

MPereira
Frequent Visitor

Excuse me @AlB!

I was at the airport and I could not respond in time!

@MPereira

 

Try this for your calculated column. Bear in mind that I am assuming here that IDs for Mother Lotes always have 14 characters and IDs for Children Lotes always 17 as you show.

 

Table1[Delete] = 
VAR IsChildrenLote = (LEN(Table1[Lote])=17)
RETURN
IF(IsChildrenLote;
     IF(CONTAINS(Table1;Table1[Lote];MID(Table1[Lote];1;14));"X")
)

 

MPereira
Frequent Visitor

GREAT @AlB!!!


That worked!!!


Thanks for your help!

 

best regards.

@MPereira

 

Here is a file with some dummy data based on what @v-danhe-msft had and with the new column. 

MPereira
Frequent Visitor

Thank you so much!!!

@MPereira

My pleasure. glad it helped. It's always nice to come across someone so grateful Smiley Happy

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors