Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
admin11
Memorable Member
Memorable Member

Error msg when i try to combine 2 column data into 1 column

Hi All

 

Yesterday  @ALLUREAN 
help me on below post

Today I try to create a expression :-

SEGMENT_M = 'SALES'[SEG] & 'SEGMENT'[SEGMENT_C]
 
Remark :- Above expression from 2 Table , SALES and SEGMENT Table
 
I get error msg :-
A single value for column 'SEGMENT_C' in table 'SEGMENT' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
 
admin11_0-1640648963848.png

The reason i need to combine SEG and SEGMENT_C is because now i need 2 Table , After successfully combine , i can use SEGMENT_M as Dimension. So only table required.

 

Paul

 

1 ACCEPTED SOLUTION

Hi,

Try this calculated column formula

SEGMENT_M_1 = if(SALES[SOURCE]="LE"||SALES[SOURCE]="SD"||SALES[SOURCE]="PW"||SALES[SOURCE]="PM"||SALES[SOURCE]="DA",'SALES'[SEG] & LOOKUPVALUE(SEGMENT[SEGMENT_C],SEGMENT[SEG_RAW],SALES[SEG]),LOOKUPVALUE(SEGMENT[SEGMENT_C],SEGMENT[SEG_RAW],SALES[SEG]))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

18 REPLIES 18
Anonymous
Not applicable

Hi @admin11 ,

 

These two columns are from different tables, you will need to have a correspondence between them before you can merge them.

Please show some sample data so that we could help.

 

Best Regards,

Jay

Ashish_Mathur
Super User
Super User

Hi,

This should typically be a calculated column formula (not a measure) in the Sales table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

 

I cannot find calculated forumla :-

admin11_1-1640653388626.png

Hope you can share with me .

 

Paul

Click on the Data tab in the left hand side vertical panel, select the appropriate Table and then write the formula in that table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

I have try still get error . Do you mean below :-

admin11_0-1640658010694.png

 

Now click on the New Column button appearing in the ribbon.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

I try to create the column , i still get error. See below image :-

admin11_1-1640659295295.png

 

Share the download link of your PBI file and show the exact result that you want.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

I know the answer is to combine SEGMENT_C field from SALES Table and SEG field from SEGMENT Table, But i don't know how to write to code .

admin11_0-1640660507913.png

My PBI file :-

https://www.dropbox.com/s/4ufqp99gpnp9ek5/PBS_VER0252%20Ask%20how%20to%20combine%20SEG%20field.pbix?...

Hi,

Try this calculated column formula

SEGMENT_M = 'SALES'[SEG] & LOOKUPVALUE(SEGMENT[SEGMENT_C],SEGMENT[SEG_RAW],SALES[SEG])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

Thank you very much for your expression , it work fine. for

SOURCE = LE , SD , PW ,PM, DA

But for SOURCE = TS , TA, TP , TI it display as "A02Business Partner" instead of "Business Partner"

 

Can you help me to add one more condition to below expression , that is only perform LOOKUPVALUE for SOURCE = LE , SD , PW ,PM, DA

 

SEGMENT_M = 'SALES'[SEG] & LOOKUPVALUE(SEGMENT[SEGMENT_C],SEGMENT[SEG_RAW],SALES[SEG])

 

Wish you happy new year

 

Paul

Hi,

Share the download link of the PBI file.  Where is the source column - in which table?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

Appreciate very much for your help. i encloed below link is the PBI sample file , with detail explanation in the page.

 

https://www.dropbox.com/s/wh91oq9alv9c5p2/PBS_VER0275.pbix?dl=0

 

Paul

 

Hi,

Try this calculated column formula

SEGMENT_M_1 = if(SALES[SOURCE]="LE"||SALES[SOURCE]="SD"||SALES[SOURCE]="PW"||SALES[SOURCE]="PM"||SALES[SOURCE]="DA",'SALES'[SEG] & LOOKUPVALUE(SEGMENT[SEGMENT_C],SEGMENT[SEG_RAW],SALES[SEG]),LOOKUPVALUE(SEGMENT[SEGMENT_C],SEGMENT[SEG_RAW],SALES[SEG]))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

Happy new year to you , Thank you very much , you code make my table look nice.

To you as well.  Glad to hear that my solution is working.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
bcdobbs
Community Champion
Community Champion

You're getting the error because you're trying to combine two columns from different tables.

 

Assuming the tables are related:

Segment 1 => Many Sales

 

try the following dax:

SEGMENT_M = 'SALES'[SEG] & RELATED ( 'SEGMENT'[SEGMENT_C] )



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

@bcdobbs @Ashish_Mathur 

 

I try your propose expression :-

SEGMENT_M_ = 'SALES'[SEG] & RELATED ( 'SEGMENT'[SEGMENT_C] )

I get error msg below :-

The column 'SEGMENT[SEGMENT_C]' either doesn't exist or doesn't have a relationship to any table available in the current context.

 

admin11_0-1640653196726.png

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.