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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jonnyA
Responsive Resident
Responsive Resident

Need help with a Power BI formula with specifis Procedure Codes

I need help creating a formula to only bring back Procedure Codes that are only 99221, 99222, and 99223 (Readmission Procedure Codes).

 

Then I would need a formula that subtracts Total Procedure codes minus the formula above.

 

End Goal: Take Readmission Procedure Codes (First formula) minus Totasl Procedure Codes.

 

Thank you for your help in advance!

 

 

 

My dataset is Test_Discharge_Dataset

 

And Im using Field "Procedure Code"

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jonnyA ,

Please have a try.

Create measures.

 

Measure = IF(MAX('Table'[Procedure_Code])=99221,MAX('Table'[Procedure_Code]),IF(MAX('Table'[Procedure_Code])=99222,MAX('Table'[Procedure_Code]),IF(MAX('Table'[Procedure_Code])=99223,MAX('Table'[Procedure_Code]),BLANK())))
Measure2 =
VAR _sum =
    SUMX ( ALL ( 'Table' ), 'Table'[Procedure_Code] )
RETURN
    CALCULATE (
        [Measure] - _sum,
        FILTER ( ALL ( 'Table' ), 'Table'[DOS] <= SELECTEDVALUE ( 'Table'[DOS] ) )
    )

 

vpollymsft_0-1645435724105.png

vpollymsft_1-1645435747745.png

 

I have also found similar posts, please refer to it to see if then help you.

Create a Readmission Formula that only brings back accts where there was a readmission w/ in 90 days 

In Power BI can I create a formula for Date of Service that brings back specific Procedure Codes? 

 

If I have misunderstood your meaning, please provide your pbix without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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 @jonnyA ,

Please have a try.

Create measures.

 

Measure = IF(MAX('Table'[Procedure_Code])=99221,MAX('Table'[Procedure_Code]),IF(MAX('Table'[Procedure_Code])=99222,MAX('Table'[Procedure_Code]),IF(MAX('Table'[Procedure_Code])=99223,MAX('Table'[Procedure_Code]),BLANK())))
Measure2 =
VAR _sum =
    SUMX ( ALL ( 'Table' ), 'Table'[Procedure_Code] )
RETURN
    CALCULATE (
        [Measure] - _sum,
        FILTER ( ALL ( 'Table' ), 'Table'[DOS] <= SELECTEDVALUE ( 'Table'[DOS] ) )
    )

 

vpollymsft_0-1645435724105.png

vpollymsft_1-1645435747745.png

 

I have also found similar posts, please refer to it to see if then help you.

Create a Readmission Formula that only brings back accts where there was a readmission w/ in 90 days 

In Power BI can I create a formula for Date of Service that brings back specific Procedure Codes? 

 

If I have misunderstood your meaning, please provide your pbix without privacy information and desired output.

 

Best Regards

Community Support Team _ Polly

 

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