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
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Top Solution Authors