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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rate
Helper III
Helper III

Multiple search for a text in another table and create various lines when found.

Hello!!

I am struggling with some calculations in Power BI, and would love if you could give me some advice on how to follow.

 

I am working on a project to detect incompatibilities in between roles in our system. We have some roles (such as being able to pay, being able to generate an invoice...) that one user can not have at the same time. If we detect one user has these two roles at the same time, we would flag a Risk.

 

For this, I have two tables:

1) Users and roles: Where we have a list of users and the roles assigned.

User IDRole ID
B0001ZS45TS00
B0001ZS48TS00
B0001ZS39TS00
B0001ZS40TS00
B0001ZS36TS00
B0001ZS38TS00
B0001ZS46TS00
B0002ZS48TS00
B0002ZS36TS00
B0002ZS38TS00
B0002ZS39TS00
B0002ZS40TS00
B0002ZS46TS00



2) Role incompatibility and risk: Where we have a list of roles in the first column, the roles that are not compatible with the role in column 1, and the risk code that we should alert if we detect a user with both roles at the same time.

Role IDIncompatibilityRisk
ZS45TS00ZS46TS00ZT01
ZS45TS00ZS48TS00ZT02
ZS45TS00ZS37TS00ZT03
ZS45TS00ZS38TS00ZT04
ZS46TS00ZS39TS00ZT05
ZS48TS00ZS47TS00ZT06
ZS48TS00ZS36TS00ZT07
ZS47TS00ZS37TS00ZT08
ZS47TS00ZS38TS00ZT09
ZS39TS00ZS41TS00ZT10
ZS39TS00ZS40TS00ZT11
ZS46TS00ZS36TS00ZT12
ZS46TS00ZS45TS00ZT01
ZS48TS00ZS45TS00ZT02
ZS37TS00ZS45TS00ZT03
ZS38TS00ZS45TS00ZT04
ZS39TS00ZS46TS00ZT05
ZS47TS00ZS48TS00ZT06
ZS36TS00ZS48TS00ZT07
ZS37TS00ZS47TS00ZT08
ZS38TS00ZS47TS00ZT09
ZS41TS00ZS39TS00ZT10
ZS40TS00ZS39TS00ZT11
ZS36TS00ZS46TS00ZT12

 

What I would want to have as an output is a table where I can detect which risks we have for every role. To obtain this information, I have to look for a particular role, look in the incompatibility table to see if any of the incompatible roles is one of the other roles that the user has active. I show you below an example for user nº 1, where we have a line for every risk detected, based on the roles assigned to that user.

User IDRole IDIncompatibilityRisk
B0001ZS45TS00ZS46TS00ZT01
B0001ZS45TS00ZS48TS00ZT02
B0001ZS45TS00ZS38TS00ZT04
B0001ZS48TS00ZS45TS00ZT02
B0001ZS48TS00ZS36TS00ZT07
B0001ZS39TS00ZS40TS00ZT11
B0001ZS39TS00ZS46TS00ZT05
B0001ZS40TS00ZS39TS00ZT11
B0001ZS36TS00ZS48TS00ZT07
B0001ZS36TS00ZS46TS00ZT12
B0001ZS38TS00ZS45TS00ZT04
B0001ZS46TS00ZS39TS00ZT05
B0001ZS46TS00ZS36TS00ZT12
B0001ZS46TS00ZS45TS00ZT01

Please, if you have any kind of clue as to how I could obtain this output, or any other way you might think of to get to a similar solution, please let me know! I am quite stuck!

Thanks a lot in advance!

1 ACCEPTED SOLUTION

Hi @Rate ,

 

Please refer to the pbix file:  https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EceWCriHaV9Etivzn3... 

 

If it doesn't meet your requirements ,please show us more details about your logic for output. 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Rate , logic is not very clear

like ZS45TS00 , exists in table2 for 4 values for both Role ID and Incompatibility. But how come it there only 3 times in final table

Hello  @amitchandak ,

 

ZS45TS00 only exists 3 times in the final table because, of the 4 times it exists in the table incompatibility (ZS46TS00, ZS48TS00, ZS37TS00 and ZS38TS00), user B0001 only has access to roles ZS48TS00, ZS46TS00 and ZS38TS00 (thus not ZS37TS00).

 

Also, I have added a new column to output table with the incompatibility that results in the risk, in case it might help better understand the logic.

 

Please, let me know if there is his clarifies anything! And thak you so very much for your time.

 

PS: I saw how the tables are showing up in the message, rather funny, but I can´t get them to show correctly. I am just pasting from Excel, in case you might know a better way to do it.

Hi @Rate ,

 

Please refer to the pbix file:  https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/EceWCriHaV9Etivzn3... 

 

If it doesn't meet your requirements ,please show us more details about your logic for output. 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

Hello my dear @v-deddai1-msft ,

 

That solution worked perfectly. Thank you so much for your time and effort!! I will speak gracefuly of you to my grandchildren when the time comes.

 

Have a great day.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.