I am trying to write a dax for the following query:
select EncounterID
,EncounterDateKey
,DxCode
,DxID
into #PatEnc
from table1
where EncounterDateKey = 20180601
and DxCode = 'Z00.00'
select count(distinct(dbf.DiagnosisCode))
from #PatEnc
left outer join tabel1 dbf on dbf.EncounterID =
#PatEnc.EncounterID
where dbf.DxCode != 'Z00.00'
My fact table has following structure
EncounterID EncounterDateKey DxCode DxID
1 20180601 Z00.00 1
1 20180601 Z00.01 2
1 20180601 D00.00 3
2 20180601 A00.0 4
2 20180601 Z00.00 1
3 20180601 B00.00 5
3 20180601 F0.0 6
so the Dax code should return the count as 3 as there are 3 different Dx Code for the Encounters that were selected when Z00.00 was selected from the slicer. I tried filter and except function for the DAX code but its not brigning the accurate results.
I get the value selected in the slicer but couldn't get the count of remaining values. Any help is appreciated.