Forum Discussion
Relate two table without a Key with conditional
- 4 years ago
Anonymous
Ok. Please tryNumber of Vehicles = VAR CurrentVolum = SELECTEDVALUE ( Salles[Volume] ) VAR MAXCapacity = MAX ( Carriers[CAPACIDADE DE] ) RETURN IF ( NOT ISBLANK( CurrentVolum ), ROUNDUP ( DIVIDE ( CurrentVolum, MAXCapacity ), 0 ) )
Hi Anonymous
There is mutch that be done here. For example optimizing the selection based on cost of transpotation of all available options or based on maximum utilization factor. That would be the challange. However, th easiest part is to retrieve the capcity of the biggest vehicle avialable from the vendor in the same city. This is a sample file with such example https://we.tl/t-CndjIAATxw
Selected TIPO =
VAR CurrentVolum = VALUES ( Salles[Volume] )
VAR MAXCapacity = MAX ( Carriers[CAPACIDADE DE] )
VAR MaxType =
MAXX (
FILTER (
VALUES ( Carriers[TIPO] ),
CALCULATE ( VALUES ( Carriers[CAPACIDADE DE] ) = MAXCapacity )
),
Carriers[TIPO]
)
RETURN
IF (
NOT ISEMPTY ( CurrentVolum ),
MaxType
)Number of Vehicles =
VAR CurrentVolum = VALUES ( Salles[Volume] )
VAR MAXCapacity = MAX ( Carriers[CAPACIDADE DE] )
RETURN
IF (
NOT ISEMPTY ( CurrentVolum ),
ROUNDUP ( DIVIDE ( CurrentVolum, MAXCapacity ), 0 )
)Please let me know how can I support you further.
- Anonymous4 years agoNot applicable
Hi tamerj1
Thanks a lot for help me, I downloaded you file and I tried to do exactly similar you, but It didn't work. Can you see any mistake in my picture? Find below the translation of the message.
Find bellow the translation of the message from the box
"a table of several values was provided, with a single expected value."
- tamerj14 years agoCommunity Champion
Anonymous
Ok. Please tryNumber of Vehicles = VAR CurrentVolum = SELECTEDVALUE ( Salles[Volume] ) VAR MAXCapacity = MAX ( Carriers[CAPACIDADE DE] ) RETURN IF ( NOT ISBLANK( CurrentVolum ), ROUNDUP ( DIVIDE ( CurrentVolum, MAXCapacity ), 0 ) )- Anonymous4 years agoNot applicable
It worked perfectly well tamerj1.
Thanks a lot!!