Forum Discussion
Problems with using more than one relationship
Hi,
I am currently struggeling to solve one issue.
In my data model I have various tables with active and inactive relationsships. In this case its about the following three tables:
Workbench (Sourced out of ERP)
Work Order Time Transaction (Sourced out of ERP)
Calender Table (Created)
The active relationships are the following:
Workbench - Work Order Time Transaction = 1:n --> there are multiple lines for each work order
Calender - Workbench = 1:n --> Date of calender is linked to Start Date of Workbench
The inactive relationsship are the following:
Workbench - Calender = n:1 --> Date of calender is linked to G/L Date of Workbench. Hence for each transtions line in the Work Order Time Transaction, there is a Date for it
There are multiple other inactive connections between Calender (Date) and Workbench (Requested Date), (Status Changed) etc.. but those are not important for the measure.
I want to measure for each Workorder that is part of the Workbench the quantity that was completed on the date that is stored in the specific line in the Work Order Time Transaction. If I use my current measures, it will always link it to the active relation from Workbench to Calender. But this is not the correct one. Enclosed an overview of the data and the desired result.
Work Order Time Transaction
| G/L Date | Work Order | Reason Code | Quantity | Operations Number |
| 121026 | 50203546 | 1G | 10.000 | 10 |
| 121027 | 50203546 | 1G | 7.500 | 20 |
| 121030 | 50203546 | 1G | 6.000 | 40 |
| 121035 | 50203546 | 1G | 5.000 | 50 |
| 121045 | 50203546 | 1G | 4.500 | 60 |
| 121046 | 50203546 | 1G | 4.000 | 70 |
| 121047 | 50203546 | 1G | 3.500 | 80 |
Workbench
| Work Order | Start Date |
| 50203546 | 15.01.2021 |
Calender
| Date | Julian Date |
My desired outcome would be the following:
| Work Order | Operations Number | Quantity | Date |
| 50203546 | 10 | 10.000 | 26.01.2021 |
| 50203546 | 20 | 7.500 | 27.01.2021 |
| 50203546 | 40 | 6.000 | 30.01.2021 |
| 50203546 | 50 | 5.000 | 04.02.2021 |
| 50203546 | 60 | 4.500 | 14.02.2021 |
| 50203546 | 70 | 4.000 | 15.02.2021 |
| 50203546 | 80 | 3.500 | 16.02.2021 |
However with the current measures that I am using, the date is always reflected based on the Workbench - Calender relationsship.
But to get those results, the relationsship between Workbench and Work Order Time Transaction has to be active, Work Order Time Transaction and Calender as well, while Workbench - Calender needs to be "deactivated".
The measure I started using should gives me the final quantity of the picked operations process but at the date of the Start Date from the work order.
End Quantity Process =
VAR Prozessschritt = SELECTEDVALUE('Work Order Time Transactions'[Operations Number],BLANK())
Return
SUMX (
'Workbench',
CALCULATE (
MIN ( 'Work Order Time Transactions'[Quantity] ),
KEEPFILTERS ( 'Work Order Time Transactions'[Reason Code] = "1G" ),
KEEPFILTERS ( 'Work Order Time Transactions'[Operations Number] = Prozessschritt),
)
)
If I add USERELATIONSHIP, I don't get any result.
I hope I explained my problem, in case you require more details please let me know.
Thanks in advance for your help/input/recommendations.
Best regards
Hanssonnor
You should be able to turn off the link between Workbench - Calender using CROSSFILTER and setting the direction to NONE. You would add this along with your USERELATIONSHIP which turns on the Calender - Work Order Time Transaction relationship.
https://docs.microsoft.com/en-us/dax/crossfilter-function
2 Replies
- jdbuchanan71Super User
You should be able to turn off the link between Workbench - Calender using CROSSFILTER and setting the direction to NONE. You would add this along with your USERELATIONSHIP which turns on the Calender - Work Order Time Transaction relationship.
https://docs.microsoft.com/en-us/dax/crossfilter-function
- hanssonnorFrequent Visitor
jdbuchanan71 sorry for my late reply and thanks for your help. I also noticed that in contrast to my initial thought my connection between the Work Order Time Transaction and Calender were not mapped correctly. I changed that and using the CROSSFILTER, I finally get the results that I needed.
Best regards
Hanssonnor