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.
Hi - I have 2 tables that I imported into my Power BI. One is Households and one is named Contacts. Each contact is linked to a Household. I want to add 2 columns to the Household Table that are called Head_1_Name and Head_2_Name.
The SQL to do this in our Database is:
Hi @mdamico ,
Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
In fact, after you add a new column in SQL Server, you click the refresh button in Power Query, and the data will be refreshed.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Value.NativeQuery() comes to your rescue; you may pass the whole intact sql to it. Another wonderful blog in this regard for your reference.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@mdamico Sample data would be infinitely more helpful than SQL code. You didn't read this:
https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
In any case, probably the best thing to do would be to do this in Power Query via a Merge query.
But, you could something like DAX as well. One way would be to create an intermediate column like:
Column =
VAR __ID = [Household_ID]
RETURN
CONCATENATEX(FILTER(Contacts,Contacts[Houshold_ID] = __ID),[Contact_ID] & [First_Name] & [Gender_ID],",")
You could then split this column out via SEARCH, LEFT, MID, etc. functions based on the comma. Again, not entirely sure what you are going for as I hate reading other people's SQL code.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.