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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Split Column with multiple values in same column

Hi

 

I have a file with multiple columns, where each column can be one or more companies. Something like the following format:

 

Date              | Company1      | Company2

01-02-2019   | 1000               | 2000

01-02-2019   | 1000               | 2000

01-02-2019   | 1000               | 2000

01-02-2019   | 1000               | 2000

...... (400 rows about)

Date              | Company 1    | Company 4

01-02-2018   | 1000               | 2000

01-02-2018   | 1000               | 2000

01-02-2018   | 1000               | 2000

01-02-2018   | 1000               | 2000

 

I need to unpivot this, to something like this:

Date              |  Company       |  Amount

01-02-2018   | Company1      | 1000

01-02-2018   | Company2      | 2000

01-02-2018   | Company3      | 2000

01-02-2018   | Company4      | 2000

.....

How can I achieve this? Is there any way?

 

BTW, This is an example of the file:

https://www.spensiones.cl/apps/valoresCuotaFondo/vcfAFPxls.php?aaaaini=2002&aaaafin=2019&tf=A&feccon...

 

Thanks!

6 REPLIES 6
Anonymous
Not applicable

@Anonymous 

Right click on the date column and select Unpivot Other Columns.

 

---
Please hit the "Accept as Solution" button if my post answered your question! If my post was helpful please consider giving it a "Thumbs Up."

Anonymous
Not applicable

Hi

 

Didn't work because doing that I've lost the relation between the companies and the amounts.

 

😞

 

Thanks

Anonymous
Not applicable

I guess I'm unclear what you mean by the "relation between the companies and the amounts"

 

You started with something like this, correct?:

Annotation 2019-12-11 135444.png

 

And you should have ended up with something like this:

Annotation 2019-12-11 135506.png

 

What do you need that this does not have?

Anonymous
Not applicable

 

The difference is that in one Column the file can have more than one Company, like these:

Sin título.png

Anonymous
Not applicable

@Anonymous 

You will have to duplicate the query and then use Remove Rows and Use First Row as Headers to transform the table into multiple queries containing one table of data each:

Annotation 2019-12-12 104703.png

Annotation 2019-12-12 104830.png

Annotation 2019-12-12 104958.png

Then add a column to each query so that the columns match across queries. Use add custom column with a value of = null

Annotation 2019-12-12 105417.png

Once the columsn in all your queries match up, append the queries as new to put them all together:

Annotation 2019-12-12 110509.png

Now right click on the date and select unpivot other columns:

Annotation 2019-12-12 110614.png

Anonymous
Not applicable

Thanks.

 

That will work for one file.. But is there any way I can automate this? The file is updated daily and it's a lot of work to update it daily. I'll need to check columns and positions every day.. There must be an easier way.. I hope!

 

Thanks

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.