Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
Karolina411
Helper V
Helper V

How to create a DAx formula to separate out 2 Metrics

Hello Dax Wizards. So I have 2 metrics to compare infections to  and wrote this formula to achive this:

# NHSN SS Infections Numerator = SUM(NhsnInfData[hfNumer])

 

# NHSN Surgical Procedure Denominator = SUM(NhsnInfData[hfDenom])

# Surgical Procedures = COUNT(NhsnInfData[MRN])

 

QSRC Avg Colo = AVERAGE(NhsnInfData[HspGoalSsiColo])

 

--Formula to get either Hospital or System goal

QSRC SSI Colo Goal = CALCULATE(

--VAR Hsp =  

VAR HspGoal = AVERAGE(NhsnInfData[HspGoalSsiColo])    --[QSRC Avg Colo]

VAR SysGoal = AVERAGE(NhsnInfData[SysGoalSsiColo])

VAR HierarchyGoal = IF(

                        ISINSCOPE(NhsnInfData[AssocLocHsp]) ,

                        HspGoal,

                        SysGoal

)

RETURN HierarchyGoal

)

Here is what the data is and it is not calculating correctly.  Does anyone have a similar example where you must compare an average to 2 different metrics? 

Karolina411_0-1712758485453.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Karolina411 ,

 

May I ask what your expected results are? Your expected results seem to be related to the ISINSCOPE function, hopefully these links will be helpful: ISINSCOPE: The Key to Dynamic Data Drilldowns - Ethan Guyant

Use IsInScope to get the right hierarchy level in DAX - Kasper On BI

 

Can you share sample data and sample output in table format?  Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Karolina411 ,

 

May I ask what your expected results are? Your expected results seem to be related to the ISINSCOPE function, hopefully these links will be helpful: ISINSCOPE: The Key to Dynamic Data Drilldowns - Ethan Guyant

Use IsInScope to get the right hierarchy level in DAX - Kasper On BI

 

Can you share sample data and sample output in table format?  Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors