Distintas condiciones en listas dependientes

Hola a todos,

Tengo un pequeรฑo problema que espero me podรกis ayudar a resolver.

Tengo 3 CAMPOS referenciados a sus correspondientes tablas y dependientes entre si. Dichas campos son [ID ESPECIALIDAD], [ID MEDICOS] E [HOSPITAL]

 El caso es que al elegir la ID ESPECIALIDAD, solo me salen los MEDICOS de esa ESPECIALIDAD,  y al elegir el MEDICO solo sale EL HOSPITAL en el que trabaja.

Para ello en ID MEDICOS utilizo la siguiente formula:

SELECT(Mรฉdicos[ID MEDICOS],
OR(
ISBLANK( [_THISROW].[ID ESPECIALIDAD] ), [ID ESPECIALIDAD] = [_THISROW].[ID ESPECIALIDAD]
)
)

y en HOSPITALES utilizo:

SELECT(Mรฉdicos[HOSPITAL],
OR(
ISBLANK( [_THISROW].[ID MEDICOS] ), [ID MEDICOS] = [_THISROW].[ID MEDICOS]
)
)

Todo funciona bien, pero me encuentro con el problema que a veces tengo que seleccionar un hospital sin haber seleccionado un medico y solo aparecen en la lista los hospitales que tiene un medico asignado y no consigo solucionarlo.

Resumiendo, necesito seguir manteniendo las dependencias y aรฑadir que si no se elige un medico aparezcan todos los hospitales, incluyendo los que no tienen asignado medico.

Espero haberme explicado y que me podรกis ayudar.

Gracias y un saludo

 

 

Solved Solved
0 5 388
1 ACCEPTED SOLUTION

Okay. I think you may need to select a default list of hospitals with an expression something like below

The suggestion assumes that you have a table of list of Hospitals with key as Hospital ID.

IF( ISBLANK([DOCTOR ID] ),

Hospitals[Hospital ID] , 

SELECT(Doctors[HOSPITAL],
 [DOCTOR ID] = [_THISROW].[DOCTOR ID]
)

)

 

If your data structure is different , please post back in which table, the entire list of hospitals is available.

View solution in original post

5 REPLIES 5

If understanding of your requirement is correct, please try 

SELECT(Doctors[HOSPITAL],
OR(
ISBLANK([DOCTOR ID] ) , [DOCTOR ID] = [_THISROW].[DOCTOR ID]
)
)

Gracias por contestar, pero de esta forma al intentar elegir el HOSPTAL, la lista desplegable aparece vacรญa.

Okay. I think you may need to select a default list of hospitals with an expression something like below

The suggestion assumes that you have a table of list of Hospitals with key as Hospital ID.

IF( ISBLANK([DOCTOR ID] ),

Hospitals[Hospital ID] , 

SELECT(Doctors[HOSPITAL],
 [DOCTOR ID] = [_THISROW].[DOCTOR ID]
)

)

 

If your data structure is different , please post back in which table, the entire list of hospitals is available.

Muchรญsimas gracias,

Tu sugerencia funciona perfectamente.

 

You are welcome.

Top Labels in this Space