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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

Create a Measure: Add an additional OR criteria

Hi,
 
I created a measure that I now need to add additional criteria to.  It is perfoming correctly but I'd now like to also include these instances:  'Claim Data Pull'[Service Code] IN {"76700", "76705", "76770", "76775", "G0389"}
 
The current formula is counting distinct Member IDs where:
- Gender = Male
- Age = 65 to 75
- Dx 1 = Z87.891, F17.210, F17.211, F17.213, F17.218, F17.219, Z00.00, Z00.01 or Z00.8
 
However, I now need it to also count/include instances where:
- Gender = Male
- Age = 65 to 75
- Service Code = 76700, 76705, 76770, 76775 or G0389
 
Current Formula:
Abdominal Aortic Aneurysm Participating = (CALCULATE(DISTINCTCOUNT('Claim Data Pull'[Member ID]), FILTER('Claim Data Pull','Claim Data Pull'[Gender]="Male"),'Claim Data Pull'[Age]>=65,'Claim Data Pull'[Age]<=75,'claim data pull'[Dx 1] IN {"Z87.891", "F17.210", "F17.211", "F17.213", "F17.218", "F17.219", "Z00.00", "Z00.01", "Z00.8"}))
 
So, how do I add OR functionality stating to count the original instances, but also these instances:
'Claim Data Pull'[Service Code] IN {"76700", "76705", "76770", "76775", "G0389"}
 
It is not as easy as this:
Abdominal Aortic Aneurysm Participating = (CALCULATE(DISTINCTCOUNT('Claim Data Pull'[Member ID]), FILTER('Claim Data Pull','Claim Data Pull'[Gender]="Male"),'Claim Data Pull'[Age]>=65,'Claim Data Pull'[Age]<=75,'claim data pull'[Dx 1] IN {"Z87.891", "F17.210", "F17.211", "F17.213", "F17.218", "F17.219", "Z00.00", "Z00.01", "Z00.8"})) (CALCULATE(DISTINCTCOUNT('Claim Data Pull'[Member ID]), FILTER('Claim Data Pull','Claim Data Pull'[Gender]="Male"),'Claim Data Pull'[Age]>=65,'Claim Data Pull'[Age]<=75,'Claim Data Pull'[Service Code] IN {"76700", "76705", "76770", "76775", "G0389"}))
 
...because there are some results with a Dx 1 match and Service Code match.  That would double count that instance.
 
 
Thank you!

 

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@Anonymous 

try

Abdominal Aortic Aneurysm Participating = (
CALCULATE(DISTINCTCOUNT('Claim Data Pull'[Member ID]),
FILTER('Claim Data Pull','Claim Data Pull'[Gender]="Male" && 
'Claim Data Pull'[Age]>=65 &&
'Claim Data Pull'[Age]<=75 &&
(
'claim data pull'[Dx 1] IN {"Z87.891", "F17.210", "F17.211", "F17.213", "F17.218", "F17.219", "Z00.00", "Z00.01", "Z00.8"} ||
'Claim Data Pull'[Service Code] IN {"76700", "76705", "76770", "76775", "G0389"}
)
)

))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Inside filter use || or and &&

Example

CALCULATE(DISTINCTCOUNT('Claim Data Pull'[Member ID]), FILTER('Claim Data Pull','Claim Data Pull'[Gender]="Male" &&'Claim Data Pull'[Age]>=65,'Claim Data Pull'[Age]<=75 && 'claim data pull'[Dx 1] IN {"Z87.891", "F17.210", "F17.211", "F17.213", "F17.218", "F17.219", "Z00.00", "Z00.01", "Z00.8"} || 'Claim Data Pull'[Service Code] IN {"76700", "76705", "76770", "76775", "G0389"}))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I think Amitchandak's solution is pretty close but it also has an error:

 

"Too many arguments were passed to the FILTER function. The maximum argument count for the function is 2."

 

It looks like the || function is limited to only 2 arguments.  Since we already have an Age clause and a Dx 1 clause ... I don't this is correctly processing the Service Code clause.

az38
Community Champion
Community Champion

@Anonymous 

maybe

Abdominal Aortic Aneurysm Participating = (
CALCULATE(DISTINCTCOUNT('Claim Data Pull'[Member ID]),
FILTER('Claim Data Pull','Claim Data Pull'[Gender]="Male"),
'Claim Data Pull'[Age]>=65,
'Claim Data Pull'[Age]<=75,

OR(
'claim data pull'[Dx 1] IN {"Z87.891", "F17.210", "F17.211", "F17.213", "F17.218", "F17.219", "Z00.00", "Z00.01", "Z00.8"},
'Claim Data Pull'[Service Code] IN {"76700", "76705", "76770", "76775", "G0389"}
)

))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

I tried changing my formula to yours and I got the following error:

 

"The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression."

 

I don't this "OR" is a recognized function in DAX unfortunately.

 

 

az38
Community Champion
Community Champion

@Anonymous 

try

Abdominal Aortic Aneurysm Participating = (
CALCULATE(DISTINCTCOUNT('Claim Data Pull'[Member ID]),
FILTER('Claim Data Pull','Claim Data Pull'[Gender]="Male" && 
'Claim Data Pull'[Age]>=65 &&
'Claim Data Pull'[Age]<=75 &&
(
'claim data pull'[Dx 1] IN {"Z87.891", "F17.210", "F17.211", "F17.213", "F17.218", "F17.219", "Z00.00", "Z00.01", "Z00.8"} ||
'Claim Data Pull'[Service Code] IN {"76700", "76705", "76770", "76775", "G0389"}
)
)

))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.