Forum Discussion
Checking if right code was deleted
Hi, need some help and hopefully this makes sense. I have 2 different tables below. The first table is the data. The second table tells you the combination of codes that cannot exist together for the same ID, and the column 2 code would need to be deleted, not the column 1 code.
For example, ID A has codes 22222 and 33333. Since code 22222 is in Column 2, it was removed and code 33333 was kept. When something is deleted, the data will be blank, but you can tell what the data is by looking at the original line item.
However, the next example is not right. ID B has codes 44444 and 11111. But instead of code 11111 being deleted, code 44444 was deleted.
I have 100,000s of rows I need to look through, anyone know how to do this easily in Power BI? I am just trying to see if the right code was deleted or not.
16 Replies
- v-diye-msftCommunity Support
Not sure if my understanding is correct.
For ID A, the data should be compared with column 2 in table2, if the data exist in column2, then it should be deleted. such as 22222
For ID B, the data should be compared with column 1 in table2,if the data exist in column1,then it should be deleted. such as 44444
If the above logic is correct, you might refer to my below measure:
Measure = SWITCH(SELECTEDVALUE('Table'[ID]),"A",IF(SELECTEDVALUE('Table'[Data]) in VALUES('Table (2)'[Column2]),BLANK(),MAX('Table'[Data])),"B",IF(SELECTEDVALUE('Table'[Data]) in VALUES('Table (2)'[Column1]),BLANK(),MAX('Table'[Data]) ))Pbix attached.
- PowerBI123456Post Partisan
v-diye-msft thanks!
So the data needs to look at both columns. You want to see if an ID has the combination of codes (column & column 2), and if it does, its deleting the column 2 code, not the column 1 code. Hope that makes sense.
- v-diye-msftCommunity Support
Do you mean if there's ID has the codes from both column 1 and column 2, then delete the one in column2?
But why you delete the 44444 in this description below? it's from column1.
" However, the next example is not right. ID B has codes 44444 and 11111. But instead of code 11111 being deleted, code 44444 was deleted. "