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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
kvbe
Frequent Visitor

Power Query conversion from single columns to multiple columns based on rowname index

For my datamodel I need to convert a table I fetch from a database into a more easy format to work with in Power BI.

The table I receive from the database is this one. (after some cleanup and transposing it)

 

CurYrPrdStat1C
CurYrPrdStat2C
CurYrPrdStat3O
CurYrPrdStat4C
CurYrPrdStat5C
CurYrPrdStat6C
CurYrPrdStat7C
CurYrPrdStat8C
CurYrPrdStat9C
CurYrPrdStat10C
CurYrPrdStat11C
CurYrPrdStat12C
CurYrPrdStat13C
CurYrPrdStat14 
CurYrPrdStat15C
CurYrPrdEnd131/07/2018 00:00
CurYrPrdEnd231/08/2018 00:00
CurYrPrdEnd330/09/2018 00:00
CurYrPrdEnd431/10/2018 00:00
CurYrPrdEnd530/11/2018 00:00
CurYrPrdEnd631/12/2018 00:00
CurYrPrdEnd731/01/2019 00:00
CurYrPrdEnd828/02/2019 00:00
CurYrPrdEnd931/03/2019 00:00
CurYrPrdEnd1030/04/2019 00:00
CurYrPrdEnd1131/05/2019 00:00
CurYrPrdEnd1230/06/2019 00:00
CurYrPrdEnd1330/06/2019 00:00
CurYrPrdEnd14null
CurYrPrdEnd15null

 

Using power Query, I would like to achieve following format:

 

PeriodCurrentPeriodEndDateCurrentStatus
Period 131/07/2018 00:00C
Period 231/08/2018 00:00C
Period 330/09/2018 00:00O
Period 431/10/2018 00:00C
Period 530/11/2018 00:00C
Period 631/12/2018 00:00C
Period 731/01/2019 00:00C
Period 828/02/2019 00:00C
Period 931/03/2019 00:00C
Period 1030/04/2019 00:00C
Period 1131/05/2019 00:00C
Period 1230/06/2019 00:00C
Period 1330/06/2019 00:00C
Period 14null 
Period 15nullC

 

So basically what I would like to achieve is using the index number (eg. CurYrPrdEnd1) and use that one as a value. 

I tried but do not really see how I could convert this using the power query editor. 

 

After that I would like to use this table to augment my datetable I generated with the

period number added to the datetable. 

 

Something like:

 

01/07/2018 Period 1 

...

31/07/2018 Period 1

01/08/2018 Period 2 

 

etc. 

 

This using the period end date specified.

I have the date table etc and merging it with this new table I should be able to manage, just sure about the two questions regarding getting it in the right format.

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi,@kvbe

    After my research, you can do these follow my steps as below:

Basic data

17.PNG

Step1:

Select column A and duplicate this column

and then select the duplicate column replace value

18.PNG

Step2:

duplicate the table

Step3:

Merge basic table with duplicate table

19.PNG

And then expand the table

20.PNG

Step4:

Add a conditional column

21.PNG

Step5:

filter custom column is 2

22.PNG

Step6:

Add the index column

23.PNG

Step7:

select Index column ,click Add Column->Standard->Modulo

24.PNG

25.PNG

Step8

filter column Modulo is 0

Step9:

select Column A and replace the value

26.PNG

Step10:

Remove unnecessary column and rename the column

 

Result:

27.PNG

 

here is demo, please try it.

https://www.dropbox.com/s/ablf38rvrhravgf/Power%20Query%20conversion%20from%20single%20columns%20to%...

 

Best Regards,

Lin

 

 

 

 

Community Support Team _ Lin
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

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi,@kvbe

    After my research, you can do these follow my steps as below:

Basic data

17.PNG

Step1:

Select column A and duplicate this column

and then select the duplicate column replace value

18.PNG

Step2:

duplicate the table

Step3:

Merge basic table with duplicate table

19.PNG

And then expand the table

20.PNG

Step4:

Add a conditional column

21.PNG

Step5:

filter custom column is 2

22.PNG

Step6:

Add the index column

23.PNG

Step7:

select Index column ,click Add Column->Standard->Modulo

24.PNG

25.PNG

Step8

filter column Modulo is 0

Step9:

select Column A and replace the value

26.PNG

Step10:

Remove unnecessary column and rename the column

 

Result:

27.PNG

 

here is demo, please try it.

https://www.dropbox.com/s/ablf38rvrhravgf/Power%20Query%20conversion%20from%20single%20columns%20to%...

 

Best Regards,

Lin

 

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Lin,

 

Thank you very much thats a neat way of approaching this! 

Never thought about the merging + index + modulo approach. 

 

Another type of technique I can add to my power query toolbox.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors