cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rodfernandez
Helper I
Helper I

Create a table in power query from another table

Hello everybody,

I am new to Power Bi and I would like you to help me with the creation of a table. I think it's simple but none of the ways I've tried has worked

I have this data table, which has the following columns "Code", "Date" and "Type"

 

CodeDateType
00101-01-2021A
00102-01-2021B
00105-01-2021C
00110-01-2021B2
00111-01-2021C2
00201-01-2021A
00205-01-2021B
00207-01-2021C
00304-01-2021A
00305-01-2021B
00401-01-2021A
00402-01-2021B
00403-01-2021A2
00407-01-2021B2
00411-01-2021A3




And that reflects the dates that the activities of the following process were carried out

rodfernandez_0-1621368087379.png

what I want to achieve in power query is a table like this

CodeA-BB-CC-B2B2-C2B-A2A2-B2B2-A3
0011111   
00211     
0031      
0041   111



the number of loops that can occur in the process is unknown, so Table 2 has to be created from scratch from Table 1

This is a table where all movements are marked with a 1 for each code.

For example, for code 004, it started at "A" then went to "B", then column "A-B" was marked with a 1, then it went back from "B" to "A2", so column "B-A2" was marked with a 1, etc ...

If someone could help me I would be very grateful

Thank you

1 ACCEPTED SOLUTION
samdthompson
Super User
Super User

Hello, heres a link to a solution for you. Probably, you want to supress loading of the start and end tables but have left so you can see the logic.

 

ProcessFlowExample 

 

// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

3 REPLIES 3
samdthompson
Super User
Super User

Hello, have fixed in the file i uploaded before (ProcessFlowExample). Just needed one more step introduced

 

// if this is a solution please mark as such. Kudos always appreciated.
samdthompson
Super User
Super User

Hello, heres a link to a solution for you. Probably, you want to supress loading of the start and end tables but have left so you can see the logic.

 

ProcessFlowExample 

 

// if this is a solution please mark as such. Kudos always appreciated.

It is almost perfect, Thanks :), the only thing that is not correct is that it is joining the last type of a code with the first type of the following code,
for example for the code "001" the flow "C2-A" appears, where that is impossible. The last type of "001" (C2) is being joined with the first of "002" (A)

ejemplofoto.png

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

Power BI Dev Camp Session 22 with aka link 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!