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
efhache
Frequent Visitor

Add columns with the true/false value based on a comparaison from other one source

Hi,

I've two sources "querry1" and "querry2".
 Querry1  contains a lot of columns but three of them are  "action_1_byuserID", "action_2_byuserID"  and "action_3_byuserID".
Querry 2 contain a column  "userID".

I would like to add a new column when the result is true when (querry1[action_1_byuserID] = querry2[UserId]) AND (querry1[action_2_byuserID] = querry2[UserId]) AND (querry1[action_3_byuserID] = querry2[UserId]).

Sure I could use three merge querry to solve it, but there is may be a better way, no?

 

Some one can help me ?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@efhache ,


DAX
new column in query 1 =
var _cnt = countx(Filter(querry2, querry1[action_1_byuserID] = querry2[UserId] && querry1[action_2_byuserID] = querry2[UserId] && querry1[action_3_byuserID] = querry2[UserId]), querry2[UserId])
return
if(isblank(_cnt), false(), True())

 

 

DAX
new column in query 2 =
var _cnt = countx(Filter(querry1, querry1[action_1_byuserID] = querry2[UserId] && querry1[action_2_byuserID] = querry2[UserId] && querry1[action_3_byuserID] = querry2[UserId]), querry1[action_3_byuserID] )
return
if(isblank(_cnt), false(), True())

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@efhache ,


DAX
new column in query 1 =
var _cnt = countx(Filter(querry2, querry1[action_1_byuserID] = querry2[UserId] && querry1[action_2_byuserID] = querry2[UserId] && querry1[action_3_byuserID] = querry2[UserId]), querry2[UserId])
return
if(isblank(_cnt), false(), True())

 

 

DAX
new column in query 2 =
var _cnt = countx(Filter(querry1, querry1[action_1_byuserID] = querry2[UserId] && querry1[action_2_byuserID] = querry2[UserId] && querry1[action_3_byuserID] = querry2[UserId]), querry1[action_3_byuserID] )
return
if(isblank(_cnt), false(), True())

Thanks a lot for the help

Indeed via DAX... it's analysis.  Thanks, it helps, just change AND by OR  and works for me 

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.