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
jellyjoe
Helper I
Helper I

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:

 

jellyjoe_0-1625134536335.png

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

1 ACCEPTED SOLUTION

Hello @jellyjoe 

 

Kumail_0-1625230096252.png

Sample .pbix file is attached for your reference.

https://drive.google.com/file/d/121sNOM_K4cHRRP6bWrJUJSwKJvS2OA-8/view?usp=sharing

 

Regards

Kumail Raza

Did this help? Kudos are appreciated

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

 

View solution in original post

12 REPLIES 12
jellyjoe
Helper I
Helper I

jellyjoe_0-1625230808834.png

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?

@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.

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.

Kumail
Post Prodigy
Post Prodigy

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

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

@jellyjoe 

 

This is giving access denied error.

Kumail_0-1625140579950.png

 

The link? 
Might be because of organizational restrictions. Unfortunately i cannot share it from onedrive or dropbox outside my organization due to my own restrictions.

@jellyjoe May be you can share that from google drive.

Hello @jellyjoe 

 

There are a few questions;

-What is the key to relate records between tables 'dbo.Conv_Stops' and 'dbo.MC_Stops'? If we take "Line+ConveyorConnection" then it is common between all the records in both tables.

-Is this logic correct for ConvStopCausedByMachine?

Kumail_0-1625227402914.png

 

 

Regards

Kumail Raza

Hello @Kumail 

The key is Line+Conveyor connector and Machine which are matched to each other using the Conv_MC_Relations table.

The logic is that we know that machine X and conveyor Y have a relation, then we get times of stops from conveyors and time of stops of machines and compare them looking for certain events.

 

The measure i wrote is correct, those are the events that I'm looking to see 1 being the event happened, 0 being the event didn't happen.

My main issue is i don't know how to display that data in a form of a table showing something looking like that:

 

line + Conveyor connectorConv stop startConv stop endCaused by Machine
AM1 CONV122021-06-24 09:00:442021-06-24 09:03:04MC1 (or blank if no match)

 

The way of determining ..caused by machine" would be the measure 1 being caused by machine and 0 not being caused by it.

Sorry if my explanation is a bit chaotic, if You have any more questions please let me know.

Hello @jellyjoe 

 

Kumail_0-1625230096252.png

Sample .pbix file is attached for your reference.

https://drive.google.com/file/d/121sNOM_K4cHRRP6bWrJUJSwKJvS2OA-8/view?usp=sharing

 

Regards

Kumail Raza

Did this help? Kudos are appreciated

Consider Accepting 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.