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
Anonymous
Not applicable

If combination of values in same column then

Hi guys, 

I have a table which contains names, ID and I woud like a new column / table with result depending on combinations on IDs.

If person has access to both ID 1 and 5 then High risk else Low risk. There I need a new column or table with four columns: Name, ID, ID2 and Risk. Eg. Name: "Mike", ID: "1", ID2: "5", Risk: "High risk". 

Table1

NameID
Mike1
Mike2
Mike3
Mike4
Mike5
Frank1
Frank2
Frank3
Frank4

 

Thanks a lot!

Mikkel

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @amitchandak ,

Perhaps I simplified my table in my post but I have 200,000 rows and multiple names with the combination of IDs to make a "High risk". E.g. currently its returning "High risk" even though the ID is not 18 and 81: 

Risk =
var _cnt =
CALCULATE(DISTINCTCOUNT('dm fct_Adgangskontrol'[Object_ID_Per]),FILTER('dm fct_Adgangskontrol','dm fct_Adgangskontrol'[UserGroupNames_Brugere] = EARLIER('dm fct_Adgangskontrol'[UserGroupNames_Brugere]) && 'dm fct_Adgangskontrol'[Object_ID_Per] in {18,81}))
RETURN
IF(_cnt = 2, "High Risk","Low risk")



View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,


Your requirement is that different Names have different combinations of combination IDs?

Different parameters correspond to different combination ID and use if nested statement, references is as follows:

New column = 
var _cnt1 = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[Name]=EARLIER('Table'[Name]) && 'Table'[ID] in {1,5}))
var _cnt2 = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[Name]=EARLIER('Table'[Name]) && 'Table'[ID] in {1,3,5}))
var _cnt3 = CALCULATE(DISTINCTCOUNT('Table'[ID]),FILTER('Table','Table'[Name]=EARLIER('Table'[Name]) && 'Table'[ID] in {1,3,5,8}))
return
if(_cnt1=2, "High risk",IF(_cnt2=3,"High risk",IF(_cnt3=4,"High risk","Low risk")))


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

amitchandak
Super User
Super User

@Anonymous , Create a new column like

 

New column =
var _cnt = calculate(distinctcount(Table[ID]), filter(Table, [Name] = earlier([Name]) && Table[ID] in {1,5}))
return
if(_cnt=2, "High risk" ,"Low risk")

Anonymous
Not applicable

Hi @amitchandak ,

Perhaps I simplified my table in my post but I have 200,000 rows and multiple names with the combination of IDs to make a "High risk". E.g. currently its returning "High risk" even though the ID is not 18 and 81: 

Risk =
var _cnt =
CALCULATE(DISTINCTCOUNT('dm fct_Adgangskontrol'[Object_ID_Per]),FILTER('dm fct_Adgangskontrol','dm fct_Adgangskontrol'[UserGroupNames_Brugere] = EARLIER('dm fct_Adgangskontrol'[UserGroupNames_Brugere]) && 'dm fct_Adgangskontrol'[Object_ID_Per] in {18,81}))
RETURN
IF(_cnt = 2, "High Risk","Low risk")



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.

Top Solution Authors