Power Query Advanced Editor Code Help

patchkek

New Member
Joined
Sep 4, 2018
Messages
9
Looking to use Power Query Advanced Editor (or any other appropriate excel tool) for the following:


Looking use code to add a column to this table ("Meets Numerator Criteria") to indicate (utilizing 0 or 1) if the unique patient number satisfies the numerator medical visit criteria outlined below (utilizing a measurement period of 1/1/2020-12/31/2021). If all MedicalVisits per unique patient satisfy numerator criteria, all rows per unique patient number show as 1 in column "Meets Numerator Criteria", ELSE 0 :

Patient NumberMedicalVisitMeets Numerator Criteria
123452/2/2019
123458/8/2019
123452/2/2020
1234510/10/2020
123454/15/2021
1234511/23/2021
183452/2/2018
183458/8/2018
183453/2/2019
183459/8/2019
183453/2/2020
1834511/10/2020
183455/15/2021
1834512/23/2021
153452/10/2018
153458/10/2018
153453/10/2019
153459/10/2019
153453/10/2020
1534511/10/2020
153455/10/2021
1534512/10/2021
113412/17/2018
113418/17/2018
113413/17/2019
113419/17/2019
113413/17/2020
1134111/17/2020
113415/17/2021
1134112/17/2021

Numerator Criteria (All bold statements must be true to satisfy numerator = 1):

At least one visit occurs in the first semester of year prior to Measurement Period​

AND: Intersection of:
Occurrence A of $MedicalVisit > 184 day(s) starts before start of "Measurement Period"
First: $MedicalVisit < 12 month(s) starts before start of "Measurement Period"

Last visit in the second semester of year prior to Measurement Period >= 60 days from first visit in prior semester​

AND: Intersection of:
Most Recent: $MedicalVisit <= 184 day(s) starts before start of "Measurement Period"
$MedicalVisit >= 60 day(s) starts after start of Occurrence A of $MedicalVisit

Last visit in the first semester of Measurement Period >= 60 days from first visit in prior semester​

AND: Intersection of:
Most Recent: $MedicalVisit < 6 month(s) starts after start of "Measurement Period"
$MedicalVisit >= 60 day(s) starts after start of First: $MedicalVisit <= 184 day(s) starts before start of "Measurement Period"

Last visit in the second semester of Measurement Period >= 60 days from first visit in prior semester​

AND: Intersection of:
Most Recent: $MedicalVisit < 184 day(s) starts before end of "Measurement Period"
$MedicalVisit >= 60 day(s) starts after start of First: $MedicalVisit < 6 month(s) starts after start of "Measurement Period"
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top