The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
i am trying to merge columns based on an IF statement and ISBLANK. If I have Country name in Table1, use that value, if not, use the Country value from Table2.
I can't see how to do this, I have created a measure but it does not give any results
Solved! Go to Solution.
Hi @smacsween ,
Just try this:
NewTable =
DISTINCT (
UNION ( DISTINCT ( Table1[Country] ), DISTINCT ( Table2[Country] ) )
)
Best regards
Icey
If this post helps, then consider Accepting it as the solution to help other members find it faster.
What I am trying to do is create a new text column:
Let's see if I can describe it differently. If the text already exists in a column from Table 1, use that. If that column in Table 1 is null or blank, instead take the text from the relevant column in Table 2.
The Union function gives me both together, and I end up with different rows but containing identical data. I only need one or the other because the field will be present in at least one of the columns, maybe both.
Hi @smacsween ,
Just try this:
NewTable =
DISTINCT (
UNION ( DISTINCT ( Table1[Country] ), DISTINCT ( Table2[Country] ) )
)
Best regards
Icey
If this post helps, then consider Accepting it as the solution to help other members find it faster.
Hi @smacsween ,
SELECTEDVALUE('Table1'[Country]) will only return the countries included in Table1, and will not compare the countries in Table1 and Table2 to see if they are included. Same as SELECTEDVALUE('Table2'[Country]).
So, if "Country 1" is only contained in Table2, SELECTEDVALUE('Table1'[Country]) will not return blank for it.
It is suggested to create a table like below and create relationships among them:
NewTable =
UNION ( DISTINCT ( Table1[Country] ), DISTINCT ( Table2[Country] ) )
Best regards
Icey
If this post helps, then consider Accepting it as the solution to help other members find it faster.
It's two text columns I want to merge so actually a measure is probably not the thing I should have tried, it should just be a new column. What would be the corresponding formula for a text merge based on that scenario?
It's a calculated column? If so, take off the MIN( ) for whichever table you are putting it on. For example, if adding the column to Table 2,
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
You said this is a measure, so I assume you are using it in a table visual. What is the relationhip between Table1 and Table2. You could try this instead, but will depend on the relatinship.
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
36 | |
24 | |
23 | |
21 | |
16 |