Forum Discussion

jellyjoe's avatar
jellyjoe
Icon for Helper I rankHelper I
5 years ago
Solved

Issue with creating a table visual from related tables.

Hello,

 

I have an issue with creating a relationship between three tables.

First let me introduce you to the data model.

We have 3 tables:

(Please note Primary keys are used for something else, they won't help with creating this relation)

 

1. Conv_Stops

 

PrimaryKeyTimestampLineConvDurationType
11112021-06-24 09:00:44:24AM1CONV-1140STOP
22222021-06-24 09:33:44:24AM1CONV-1178STOP


2. MC_Stops

 

PrimaryKeyTimestampLineMCDuration
33332021-06-24 09:00:22:24AM1MC-170
44442021-06-24 09:21:22:24AM1MC-1110
55552021-06-24 12:21:22:24AM1MC-110

 

3. Conv_MC_Relations

 

LineConveyorPitchMachine
AM1CONV-11MC1
AM1CONV-22MC2
AM1CONV-33MC3
AM1CONV-44MC4
AM1CONV-55MC5

 

I've created a relation like this:

 

Where the relations are

MC STOPS -----(connected by MC = Machine)---- CONV_MC_RELATIONS------(connected by conveyor = conv)------ CONV STOPS

 

My goal is to create a table(visualisation) like this:
(Shows all the Conv_Stops)

 

ConveyorTimestamp(from Conv_stops)Duration(from Conv_stops)caused by machine
CONV-12021-06-24 09:00:44:24140MC1
CONV-12021-06-24 09:33:44:24178 

 

Where caused by machine will write the machine if:

[MC timestamp] starts before [Conv timestamp] AND
[MC timestamp + MC Duration] ends after [Conv timestamp + Conv Duration]
OR
[MC timestamp + MC Duration] starts after [Conv timestamp] AND
[MC timestamp] starts before [Conv timestamp]

 

Is there a way i can achieve this?
Thanks in advance for the help.

 

Meddled with the file a bit, here's link to current PBIX.

Link to PBIX: https://easyupload.io/43lnuc

12 Replies

  • Kumail's avatar
    Kumail
    Icon for Impactful Individual rankImpactful Individual

    Hello jellyjoe 

     

    If you could send sample .pbix that demonstrate what you are looking to get. It would really help providing you a quick solution.

     

    You can send the sample .pbix file by adding it to your drive or dropbox and add the link here. 

     

    Regards
    Kumail Raza

    • jellyjoe's avatar
      jellyjoe
      Icon for Helper I rankHelper I

      Sure thing!

       

      I've uploaded it here: https://easyupload.io/43lnuc

      In the meantime i've tried messing with it a little, managed to create a table (seen on the report) that catches when the times overlap, but i'm not sure how to achieve the effect i wrote about.

       

      Regards

      Damian Gęglawy

  • Thank you four your support!
    That is what I'm looking for except that I'd like to see ALL conveyor stops and just have a caused by MC written in a column if it happened to be caused by one. If not then that column would be left blank.
    Is that possible?

    • Kumail's avatar
      Kumail
      Icon for Impactful Individual rankImpactful Individual

      jellyjoe 

      Please excuse, however, this is not a very common practise as both the tables 'dbo.MC_Stops' and 'dbo.Conv_Stops' have many to many relationship and not a single record in 1 table relate to a single record in other table.

       

      Although it is possible, however, it would require new virtual table to be created to apply this thing.

       

      Regards

      Kumail Raza

      Did this help? Kudos are appreciated

      Consider Accepting it as the solution to help the other members find it more quickly.

      • jellyjoe's avatar
        jellyjoe
        Icon for Helper I rankHelper I

        I see, still thank you very much for your help.
        I'll mark this issue as resolved and make another post about the virtual table.