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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Locco
Helper III
Helper III

Material schedule adherence

Hi all,

 

I have a table with production data which includes production date, quantity, production machine, and part produced. I have another, master table, which shows each production machine and which specific parts should be built on which specific machines.

 

I'd like to compare the production table to the master table and if a part was built on a machine other than what is on the master table to be able to display a message such as "deviation." I've seen a few similar "if this data is on another table" problems/solutions but were not able to get those solutions to work.

 

Sample data is basically

 

Production table

DateProduction MachinePartQuantity
12/5/2021Machine1PartA100
12/5/2021Machine1PartB120
12/5/2021Machine3PartC100
12/5/2021Machine4PartD125
12/5/2021Machine3PartE162
12/5/2021Machine1PartF95

 

Master table

Production MachinePart
Machine1PartA
Machine1PartB
Machine2PartC
Machine2PartD
Machine3PartE
Machine3PartF
Machine4PartG
Machine4PartH
Machine4PartI

 

Thanks!

1 ACCEPTED SOLUTION

Hi @Locco ,

I created a sample pbix file(see attachment), please check whether that is what you want.

Measure = 
VAR _selmpart =
    SELECTEDVALUE ( 'Master'[Part] )
VAR _tabm =
    CALCULATETABLE (
        VALUES ( 'Master'[Production Machine] ),
        FILTER ( 'Master', 'Master'[Part] = _selmpart )
    )
VAR _tabp =
    CALCULATETABLE (
        VALUES ( 'Production'[Production Machine] ),
        FILTER ( 'Production', 'Production'[Part] = _selmpart )
    )
RETURN  
    IF (
        ISEMPTY ( _tabp ),
        BLANK (),
        IF ( COUNTROWS( EXCEPT ( _tabm, _tabp ) )>0 , "deviation", "same" )
    )

yingyinr_0-1639044640085.png

Best Regards

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

6 REPLIES 6
amitchandak
Super User
Super User

@Locco , New column Production table

if([Production Machine] = maxx(filter(Master , Master[Part] =Production[Part] ), Master[Product Machine]), true(), false()) 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks @amitchandak , that does work but I ran into another problem.

 

The master table has a few parts which build on 2 different machines. For these, even though it ran on one of the two correct machines, it is displaying false instead of true.

 

Is there a modification to allow it to give a correct result with this in mind?

Hi @Locco ,

I created a sample pbix file(see attachment), please check whether that is what you want.

Measure = 
VAR _selmpart =
    SELECTEDVALUE ( 'Master'[Part] )
VAR _tabm =
    CALCULATETABLE (
        VALUES ( 'Master'[Production Machine] ),
        FILTER ( 'Master', 'Master'[Part] = _selmpart )
    )
VAR _tabp =
    CALCULATETABLE (
        VALUES ( 'Production'[Production Machine] ),
        FILTER ( 'Production', 'Production'[Part] = _selmpart )
    )
RETURN  
    IF (
        ISEMPTY ( _tabp ),
        BLANK (),
        IF ( COUNTROWS( EXCEPT ( _tabm, _tabp ) )>0 , "deviation", "same" )
    )

yingyinr_0-1639044640085.png

Best Regards

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

Thanks @v-yiruan-msft , but I was unable to get the measure to work correctly.

 

I created a visual table with the production machines in a column and the parts in a column. I have about 30 rows, when I add the measure as a new column the results filter down to only 1 row. This is also the only machine/part combination which is unique, meaning only 1 part is built on that machine. For the other machines which build multiple parts, they were removed or on another table they have a blank, only the 1 part is showing "same."

 

Also, in the screenshot you provided the measure is returning an incorrect value. "Part B" should say "same," and not "deviation."

Hi @Locco ,

Did you create any relationship between Master and Production? It is not required to create any relationship between them. If it is possible, could you please share your simplified sample pbix file (exclude sensitive data) with me in order to make troubleshooting and provide you a suitable solution?

In addition, for Part B in my sample pbix file, there are two machines Machine1 and Machine2 for Part B in table Master, but there is only one Machine1 in table Production. So the returned value for the measure is "deviation". If my understanding is wrong, please feel free to correct me with more details. Thank you.

yingyinr_1-1639105096692.png

Best Regards

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

Thanks again @v-yiruan-msft ,

 

After some further experimentation I believe I got it to work. I will need to so some larger testing over the weekend to confirm, but I will check back in to let you know.

 

Thanks for your help!

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.