Forum Discussion
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
| Date | Production Machine | Part | Quantity |
| 12/5/2021 | Machine1 | PartA | 100 |
| 12/5/2021 | Machine1 | PartB | 120 |
| 12/5/2021 | Machine3 | PartC | 100 |
| 12/5/2021 | Machine4 | PartD | 125 |
| 12/5/2021 | Machine3 | PartE | 162 |
| 12/5/2021 | Machine1 | PartF | 95 |
Master table
| Production Machine | Part |
| Machine1 | PartA |
| Machine1 | PartB |
| Machine2 | PartC |
| Machine2 | PartD |
| Machine3 | PartE |
| Machine3 | PartF |
| Machine4 | PartG |
| Machine4 | PartH |
| Machine4 | PartI |
Thanks!
- Anonymous4 years ago
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" ) )Best Regards
6 Replies
- amitchandakSuper User
Locco , New column Production table
if([Production Machine] = maxx(filter(Master , Master[Part] =Production[Part] ), Master[Product Machine]), true(), false())
- LoccoHelper III
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?
- AnonymousNot applicable
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" ) )Best Regards