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
rashid0146
Regular Visitor

Create a new table from columns from existing tables

Hi All
 
I have two columns, one is customer ID and 2nd is Customer Parent. I need a 3rd column containg values from first and 2nd as shown below.
 
Customer ID        Customer Parent ID        3rd Column (I Want to Create in Power BI)
0001                     0010                                  0010
0002                                                               0002
0003                     0010                                  0010
0004                                                               0004
0005                     0011                                  0011
0006                                                               0006
0007                                                               0007

I was provided by with this solution

Column3 = IF(ISBLANK([Customer Parent ID]),[Customer ID],[Customer Parent ID])

 

I applied above formula Column3 = IF(ISBLANK([Customer Parent ID]),[Customer ID],[Customer Parent ID]) but it is not picking the value for blak field. I mean it is giving the following results shown in 3rd column. One thing to note that source of data is SQL server. I guess ISBLANK function si not recognizing the Blank fields in Customer Parent ID table as blank that is why returning the results below.

 

Customer ID        Customer Parent ID        3rd Column (I Want to Create in Power BI)
0001                     0010                                  0010
0002                                                              
0003                     0010                                  0010
0004                                                              
0005                     0011                                  0011
0006                                                              
0007                                                              

 

Please help me in getting out of this

Best Regards

Rashid Anwar

2 ACCEPTED SOLUTIONS
ImkeF
Super User
Super User

I'd recommend to clean your data before loading into the datamodel:

 

In the query editor, select the column "Customer Parent ID" and go to Transform -> Text Column -> Format -> Clean

 

That will remove any non-printable characters from your data that could cause the problem.

 

If the "blank-to-be"-field don't show up with a "null" -value (in italics), then they are not really blank and your DAX-functions will not work properly. In that case try the following:

 

Check your column again, go to Transform -> Any Column -> Replace Values and replace "nothing" by "null" like this:

 

ReplaceNothingByNull.jpg

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

v-chuncz-msft
Community Support
Community Support

@rashid0146,

 

Use DAX below instead.

Column3 =
IF ( [Customer Parent ID] = "", [Customer ID], [Customer Parent ID] )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@rashid0146,

 

Use DAX below instead.

Column3 =
IF ( [Customer Parent ID] = "", [Customer ID], [Customer Parent ID] )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ImkeF
Super User
Super User

I'd recommend to clean your data before loading into the datamodel:

 

In the query editor, select the column "Customer Parent ID" and go to Transform -> Text Column -> Format -> Clean

 

That will remove any non-printable characters from your data that could cause the problem.

 

If the "blank-to-be"-field don't show up with a "null" -value (in italics), then they are not really blank and your DAX-functions will not work properly. In that case try the following:

 

Check your column again, go to Transform -> Any Column -> Replace Values and replace "nothing" by "null" like this:

 

ReplaceNothingByNull.jpg

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

fhill
Resident Rockstar
Resident Rockstar

Can you convert the columns to whole numbers instead of text?  This might help remove whatever 'non blank' value is confusing your query?  




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




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.