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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Gadwood74
Frequent Visitor

Addcolumn + format + &

Hi - newby here.

I want to add a column in a table from 2 fields: Account and sub account.

 

The account is 123

Sub account is 45

 

My standard GL format is "000000-0000"

 

I'm looking for the correct formula. The way I think it (that obviously doesn't work) is:

 

#"KeyGL" = Table.AddColumn(DBIFGV_Table, "KeyGLBase", each FORMAT([DBGV_ACCOUNT],"000000") & FORMAT([DBGV_SUB_ACCOUNT],"0000"))

 

The result I'm looking for would be 00123-0045

Thanks!

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

= Table.AddColumn(Source, "Custom", each Text.PadStart([Column1], 6, "0") & "-" & Text.PadStart([Column2], 4,"0"))

Make sure that the two fields are text before this line.  I think there's a slight mismatch between your format ( is "000000-0000") and the result you gave (00123-0045)

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

= Table.AddColumn(Source, "Custom", each Text.PadStart([Column1], 6, "0") & "-" & Text.PadStart([Column2], 4,"0"))

Make sure that the two fields are text before this line.  I think there's a slight mismatch between your format ( is "000000-0000") and the result you gave (00123-0045)

Wow thanks so much!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors