Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I've 2 tables with no relationship between them, I would like to create a measure to add one column, Membership from table 2 to table 1. Table 1 is on the left and Table 2 is on the right.
I created this measure in table 1:
Solved! Go to Solution.
Calculated table exactly as you have created it, not in PQ.
PQ is another option I recommended but not the solution provided
Try GENERATEALL instead if you want the rows with no committee as well:
First Table B V2 =
GENERATEALL (
'First Table',
VAR contactCompany_ = 'First Table'[contact/company]
VAR resT_ =
CALCULATETABLE (
DISTINCT ( 'Second Table'[Committee] ),
FILTER (
ALL ( 'Second Table'[company], 'Second Table'[contact] ),
LEN ( contactCompany_ ) > 0
&& ( 'Second Table'[contact] = contactCompany_ || 'Second Table'[company] = contactCompany_ )
)
)
RETURN
resT_)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
If you are happy to do this in a visual (as opposed to adding a new column to a table) you can use the TREATAS function
Proud to be a Super User!
Paul on Linkedin.
You should do this in Power Query.
It will not work on a visual without modifying the underlying First table, since you seem to be adding rows. You can create a new calculated table:
First Table B =
GENERATE (
'First Table',
VAR contactCompany_ = 'First Table'[contact/company]
RETURN
CALCULATETABLE (
DISTINCT ( 'Second Table'[Committee] ),
FILTER (
ALL ( 'Second Table'[company], 'Second Table'[contact] ),
LEN ( contactCompany_ ) > 0
&& ( 'Second Table'[contact] = contactCompany_
|| 'Second Table'[company] = contactCompany_ )
)
)
)
I reiterate that this should be done in PQ.
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
@AlB Thank you. I'm not sure how to create a calculated table with DAX in power query? Could you please advise? When I create the table via modeling and new table, I get the following but a few rows are missing from membership number 29 to 36. Thanks again.
Calculated table exactly as you have created it, not in PQ.
PQ is another option I recommended but not the solution provided
Try GENERATEALL instead if you want the rows with no committee as well:
First Table B V2 =
GENERATEALL (
'First Table',
VAR contactCompany_ = 'First Table'[contact/company]
VAR resT_ =
CALCULATETABLE (
DISTINCT ( 'Second Table'[Committee] ),
FILTER (
ALL ( 'Second Table'[company], 'Second Table'[contact] ),
LEN ( contactCompany_ ) > 0
&& ( 'Second Table'[contact] = contactCompany_ || 'Second Table'[company] = contactCompany_ )
)
)
RETURN
resT_)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
@AlB Thank you, that works well. One last question. Can I add more columns besides committee? If I wanted to add Membership for example?
@AlB I used Summarize instead of Distinct and it seems to do the job fine. Thanks again.
Hi @jimmyfromus
Please explain the logic behind it. How do you get the committee from Table2? Why should it be "dancing" for that last 4th row??
Show the full expected result
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Table 1 has a company/contact column, whereas table 2 has these columns seperated. So in table 2, company a and contact a have dancing as a committee value. I would like to show this in table 1 where company a has a committee value of dancing and the same for contact a.
The expected result would be like so.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |