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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
prakritnepal
Helper I
Helper I

new table from connected existing tables

Hi, 

 

I am trying to create a new temp table based on the selection. This is supposed to show the expected stages in order to ship process and the current stage an order is currently at. The part I am not being able to do is bring data together from different tables and put it in a gantt chart based on the selection on the slicer. Gantt chart is kinda important here because that gives a clear view of expected ship dates and completion dates for different labor processes. The current structure of my data is something like:

 

Table1 
Order numberorder date
12341/1/2019
45671/1/2019
56781/1/2019

 

Table 2 
order numberjob num
1234qwer
4567asdf
5678zxcv

 

Table 3 
Job numlab connector
qwer1
asdf2
zxcv3

 

Table 4   
lab connectorop processstart dateend date
1item 12/1/20192/11/2019
1item 22/11/20192/21/2019
1item 32/21/20193/3/2019

 

 

Table 5  
Job numEng datedoc date
qwer2/12/20192/11/2019
asdf2/13/20192/21/2019
zxcv2/14/20192/27/2019

 

 

Desired Output based on slicer selection:

 

selection 1234  
ItemsStart dateEnd date
Order Date1/1/2019 
Eng date 2/12/2019
Doc date 2/11/2019
item 12/1/20192/11/2019
item 22/11/20192/21/2019
item 32/21/20193/3/2019

 

 

The data is coming from different sources and there are layers of connecting tables. I can get all the data individually but I am not being able to put it together in a gantt chart. 

 

What I have tried:

merging/appending: too much data and no clear way to filter that. couldn't figure out a way

Union-select column:

Temp table = UNION(SELECTCOLUMNS('Erp JobOper',"Item",'Erp JobOper'[OpCode],"complete",'Erp JobOper'[OpComplete],"start date",'Erp JobOper'[QueStartDate],"due date",'Erp JobOper'[DueDate],"num",'Erp JobOper'[JobNum]),
SELECTCOLUMNS('Erp OrderHed',"Item",'Erp OrderHed'[OrderNum],"complete",'Erp OrderHed'[OpenOrder],"start date",'Erp OrderHed'[OrderDate],"due date",'Erp OrderHed'[DoNotShipAfterDate],"num",'Erp OrderHed'[OrderNum]))

this kinda did what I was looking for but again no clear way filter this table as I need to filter by order number and still get all the data. 

ideally, if I can do union-select for data from related tables based on the slicer selection that would be great. I would love to have other options as well if possible or a better way.

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Hi @prakritnepal 

You may try 'Unpivot columns' in query editor and Union function to get the table.For example.

Table =
DISTINCT (
    UNION (
        SELECTCOLUMNS ( Table1, "item", Table1[Attribute] ),
        SELECTCOLUMNS ( Table4, "item", Table4[op process] ),
        SELECTCOLUMNS ( Table5, "item", Table5[Attribute] ),
        SELECTCOLUMNS ( Table5, "item", Table5[Attribute.1] )
    )
)

Regards,

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

3 REPLIES 3
v-cherch-msft
Employee
Employee

Hi @prakritnepal 

You may create table 6 and use below measure.Attached sample file for your reference.

Start date =
IF (
    MAX ( Table6[Items] ) = "Order date",
    CALCULATE ( MAX ( Table1[order date] ) ),
    IF (
        MAX ( Table6[Items] ) = "item 1",
        CALCULATE (
            MAX ( Table4[start date] ),
            FILTER ( ALLSELECTED ( Table4 ), Table4[op process] = "item 1" )
        ),
        IF (
            MAX ( Table6[Items] ) = "item 2",
            CALCULATE (
                MAX ( Table4[start date] ),
                FILTER ( ALLSELECTED ( Table4 ), Table4[op process] = "item 2" )
            ),
            IF (
                MAX ( Table6[Items] ) = "item 3",
                CALCULATE (
                    MAX ( Table4[start date] ),
                    FILTER ( ALLSELECTED ( Table4 ), Table4[op process] = "item 3" )
                )
            )
        )
    )
)

1.png

Regards,

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

Thank you for the suggestion. 

Is there a way the items can be pulled in dynamically? They change from one order to another for the type of operation. 

Hi @prakritnepal 

You may try 'Unpivot columns' in query editor and Union function to get the table.For example.

Table =
DISTINCT (
    UNION (
        SELECTCOLUMNS ( Table1, "item", Table1[Attribute] ),
        SELECTCOLUMNS ( Table4, "item", Table4[op process] ),
        SELECTCOLUMNS ( Table5, "item", Table5[Attribute] ),
        SELECTCOLUMNS ( Table5, "item", Table5[Attribute.1] )
    )
)

Regards,

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.