试图找到一个公式,让我可以显示某些值。
示例:
我想看到阿司匹林和华法林,以及(下面3个值中的一个或多个)氯吡格雷、普拉格雷或替加瑞尔。
Patient1采用:
阿司匹林、华法林、氯吡格雷
患者2服用:阿司匹林华法林
现在我看到的是患者1和患者2,我只想看到像患者1这样的患者,展示了3种不同的药物。
请提前帮助并感谢您。我正在使用crystal reports 2008。
发布于 2013-03-20 21:33:43
我建议在SQL select子句中添加类似以下行的内容:
count(distinct case when medication in ('Aspirin', 'Warfarin')
then medication end)
over (partition by patient) as mandatory_meds,
count(distinct case when medication in ('Clopidogrel', 'Prasugrel', 'Ticagrelor')
then medication end)
over (partition by patient) optional_meds,然后,
and mandatory_meds = 2 and optional_meds >= 1或者,您可以通过以下方式在Crystal中实现类似的结果:
if {myTable.medication} = "Aspirin" or {myTable.medication} = "Warfarin"
then {myTable.medication}
if {myTable.medication} = "Clopidogrel" or {myTable.medication} = "Prasugrel"
将条件or {myTable.medication} = "Ticagrelor" then {myTable.medication}
DistinctCount({@mandatory_meds})=2 and DistinctCount({@optional_meds})>=1
https://stackoverflow.com/questions/15523859
复制相似问题