Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I have 2 Geo columns coming from 2 different tables. I want to create a 3rd column such that:
if Table1.Geo is blank then Table2.Geo, else Table1.Geo
Table1.Geo | Table2.Geo | Final Geo |
Europe | Europe | |
Asia | Asia | |
null | null | null
|
However, I dont think replacing blank values in the Final Geo column using such conditions is a good practise.
I say this becuase in reality, I have 50 other columns where I need to do the same thing.
I think this is not scalable.
is there an easier way out to this problem?
I need the solution in M Code
Please provide some more sample data (ie more columns) and show the expected outcome.
Sample data is client confidential
But the intuituion is simple
Just consider that I have 50 columns like the one I mentioned above.
For these 50 columns i dont want to write conditional statements for each
Whats the easy way out?
Here is another example.
Orange columns are output columns
Geo 1 | Geo 2 | Country 1 | Country 2 | Final Geo | Final Country |
Asia | Asia | India | India | Asia | India |
null | Europe | null | US | Europe | US |
HI @klehar,
How did these table records mapping? Can you please share some more detailed information to help us clarify your scenario and test to coding formula?
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
@Anonymous Geo field has come from 2 tables. Both columns contain some nulls. So i created a new column that can replace nulls if atleast one column contains a non null value. Like Geo I have 40 other columns that have the same case.So I was thinking of a smarter solution instead of creating 40 conditional columns
Hi @klehar,
This is the reason we required more detailed information.
If these tables have relationship keys to mapping different records, you can extract these keys to create a bridge table to link these tables and add calculated fields with replaced geo values.
After these steps, you can directly invoke this replaced bridge table field to get results.
Regards,
Xiaoxin Sheng
Mentioning "confidential" is one of the inhibitors of getting help. Providing incorrect sample data is another.
Please reconsider.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
56 | |
56 | |
38 | |
29 |
User | Count |
---|---|
75 | |
62 | |
45 | |
40 | |
39 |