cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CKNIGHT
Helper I
Helper I

Reserving a DAX Function to show the opposite %

Hello:  My Dax Function is: 

Correctly Medicated for Hypoglycemia = IF(ISBLANK([Numerator_HYP1_MED]), 0, [Numerator_HYP1_MED])/IF(ISBLANK([Denominator_HYP1]),0,[Denominator_HYP1])
 
I need to write a 2nd Dax Function to show the reverse like below (I did that in a different way below using 0- then -100):
CKNIGHT_0-1631287027012.png

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @CKNIGHT ,

 

have you tried this

Mesure 2 = 1 - [Measure 1]

Hopefully this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

4 REPLIES 4
CKNIGHT
Helper I
Helper I

I am using the following SQL to bring in 61k rows of data as a Denominator :

Select Distinct E.PreHospital_Report as PreHospital_Report, E.DateofCall, P.Age, P.Age_Units,
Case when S.Primary_Impression Like '%E16.2%' then 'Hypoglycemia; unspecified' when S.Primary_Impression Like '%R41.82%'
then 'Altered Mental Status, Unspecified' when S.Primary_Impression = 'A41.9' then 'Sepsis, unspecified organism'
when S.Primary_Impression = 'G40.909' then 'Epilepsy, unspecified, not intractable, without status epilepticus'
when S.Primary_Impression = 'E13.64' then 'Other specified diabetes mellitus with hypoglycemia'
when S.Primary_Impression = 'F10.9' then 'Alcohol Use, Unspecified'
when S.Primary_Impression = 'F19' then 'Other psychoactive substance related disorders'
when S.Primary_Impression = 'T14.90' then 'Injury Unspecified' when S.Primary_Impression = 'I46.9' then 'Cardiac Arrest'
when S.Primary_Impression = 'R51' then 'Headache' when S.Primary_Impression = 'I46.9' then 'Cardiac Arrest'
When S.Primary_Impression = 'E13.64' then 'Other specified diabetes mellitus with hypoglycemia'
When S.Primary_Impression = 'J80' then 'Acute respiratory distress syndrome'
When S.Primary_Impression = 'J98.01' then 'Acute bronchospasm'
When S.Primary_Impression = 'I63.9' then 'Cerebral infarction, unspecified'
When S.Primary_Impression = 'E86.1' then 'Hypovolemia'
when S.Primary_Impression = 'R53.1' then 'Weakness'
when S.Primary_Impression = 'T68' then 'Hypothermia'
when S.Primary_Impression = 'I95.9' then 'Hypotension, unspecified'

when S.Primary_Impression = 'E16.1' then 'Other hypoglycemia'
Else S.Primary_Impression End AS Primary_Impression,
Case when S.Secondary_Impression Like '%E16.2%' then 'Hypoglycemia; unspecified'
when S.Secondary_Impression Like '%R41.82%' then 'Altered Mental Status, Unspecified'
when S.Secondary_Impression Like '%R53.1%' then 'Weakness'
When S.Secondary_Impression Like '%J98.01%' then 'Acute bronchospasm'
when S.Secondary_Impression Like '%E13.64%' then 'Other specified diabetes mellitus with hypoglycemia'
when S.Secondary_Impression Like '%F10.9%' then 'Alcohol Use, Unspecified'
when S.Secondary_Impression Like '%A41.9%' then 'Sepsis, unspecified organism' When S.Secondary_Impression Like '%E13.64%' then
'Other specified diabetes mellitus with hypoglycemia'When S.Secondary_Impression Like '%F99%' then
'Mental disorder, not otherwise specified'
when S.Secondary_Impression Like '%G40.909%' then 'Epilepsy, unspecified, not intractable, without status epilepticus'
when S.Secondary_Impression = '%T68%' then 'Hypothermia'
when S.Secondary_Impression Like '%T14.90%' then 'Injury Unspecified'when S.Secondary_Impression Like '%I46.9%' then 'Cardiac Arrest'
When S.Secondary_Impression Like '%F99%' then
'Mental disorder, not otherwise specified'
when S.Secondary_Impression Like '%F19%' then 'Other psychoactive substance related disorders'
when S.Secondary_Impression Like '%E16.1%' then 'Other hypoglycemia'
When S.Secondary_Impression Like '%J80%' then 'Acute respiratory distress syndrome'
when S.Secondary_Impression Like '%R51%' then 'Headache'
When S.Secondary_Impression Like '%I63.9%' then 'Cerebral infarction, unspecified'
When S.Secondary_Impression LIKE '%E86.1%' then 'Hypovolemia'
Else S.Secondary_Impression End AS Secondary_Impression,

V.Total_Glasgow_Coma_Score,
V.Level_of_Responsiveness
as Level_of_Responsiveness



From eTimes_01 E with (nolock)
left Join eVitals_1 V ON E.PreHospital_Report = V.PreHospital_Report
left Join eSituation_1 S on E.PreHospital_Report = S.PreHospital_Report
left join ePatient_1 P on E.PreHospital_Report = P.PreHospital_Report



WHERE e.PreHospital_Report IN
(((
(
(
(SELECT DISTINCT PreHospital_Report FROM eSituation_1 WITH (NOLOCK) WHERE Primary_Impression LIKE '%E16.2%'OR Primary_Impression Like '%E13.64%'
OR Secondary_Impression Like '%E13.64%' OR Secondary_Impression LIKE '%E16.2%')
INTERSECT
(SELECT DISTINCT PreHospital_Report FROM eVitals_1 WITH (NOLOCK) WHERE Total_Glasgow_Coma_Score
<> '-100' and Total_Glasgow_Coma_Score is not null and Total_Glasgow_Coma_Score <> '-300' and Total_Glasgow_Coma_Score in (1,2,3,4,5,6,7,8,9,10,11,12,13,14)
OR Level_of_Responsiveness not like '-100'and Level_of_Responsiveness IN (3326003, 3326005, 3326007) and
(Level_of_Responsiveness <>-100 and Level_of_Responsiveness <> -300))
)
)INTERSECT(SELECT DISTINCT PreHospital_Report FROM eResponse_1
WHERE TypeofService = 2205001 )
INTERSECT(SELECT DISTINCT PreHospital_Report FROM eTimes_01
WHERE DateofCall BETWEEN CAST('01-Jan-2019' as date) AND GETDATE()))
) EXCEPT (
(SELECT DISTINCT PreHospital_Report FROM ePatient_1 WHERE Age_Units = 'Hour(s)'
AND Age <= 24 /*IN (' ', '1','2','3','4','5','6',
'7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23')*/
) UNION (SELECT DISTINCT PreHospital_Report FROM ePatient_1 WITH (NOLOCK) WHERE Age_Units = 'Minute(s)'
AND Age <=120


) ))

 

Then I use this SQL as a Numerator to filter off the # of calls by when medication was given:

Select Distinct E.PreHospital_Report,
Case when M.Medication_Given Like '%4832%' then 'Glucagon'
when M.Medication_Given ='4850' then 'Glucose'
when M.Medication_Given = '377980' then 'Glucose Oral Gel'
when M.Medication_Given = '376937'
then 'Glucose Injectable Solution'
when M.Medication_Given = '372326' then 'Glucose Chewable Tablet'
when M.Medication_Given = '237653' then '50% Dextrose -Glucose 500 MG/ML Injectable Solution'
when M.Medication_Given = '260258' then '25% Dextrose - Glucose 250 MG/ML Injectable Solution'
when Medication_Given = '309778' then '5% Dextrose - Glucose 50 MG/ML Injectable Solution'
when M.Medication_Given = '1795610' then '10% Dextrose -250 ML Glucose 50 MG/ML Injection'
when M.Medication_Given ='1795477'then '10% Dextrose -500 ML Glucose 100 MG ML Injection'
when M.Medication_Given = '1794567' then 'Glucose Injection'
when M.Medication_Given = '1165823' then 'Glucose Oral Product'
when M.Medication_Given = '237648' then 'D10 - Dextrose'
when M.Medication_Given = '1165819' then 'Glucose Injectable Product'
else M.Medication_Given end as Medication_Given,
Pr.Procedure_Given As [Procedure]


From eTimes_01 E

left Join eMedications_1 M on E.PreHospital_Report = M.PreHospital_Report
left join eProcedures_1 PR on E.PreHospital_Report = PR.PreHospital_Report

WHERE e.PreHospital_Report IN
(
((SELECT DISTINCT PreHospital_Report FROM eMedications_1 WITH (NOLOCK)
WHERE Medication_Given is not null and Medication_Given IN ('4832','4850','237648','377980','376937',
'372326','237653','260258','309778','1795610','1795477','1794567','1165823','1165822','1165819')
UNION
SELECT DISTINCT PreHospital_Report FROM eProcedures_1 WITH (NOLOCK)
WHERE Procedure_Given IN ('710925007','225285007'))))

I then use a DAX but since I am filtering I do not know the DAX modification to do the reverse

TomMartens
Super User
Super User

Hey @CKNIGHT ,

 

have you tried this

Mesure 2 = 1 - [Measure 1]

Hopefully this provides what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

@thanks a ton TOM...I shall try it and then accept it..My report overloaded and just crashed

 

Hi @CKNIGHT,

How many records are your report stored? Any complex nested or looping calculation include in these expressions?

Please share more detailed information to help us clarify this scenario:

How to Get Your Question Answered Quickly
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!