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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
pmcinnis
Helper III
Helper III

What is wrong with this DAX script?

Would appreciate it if someone could correct my error in the following DAX script:

 

res ct finished =
CALCULATE(
   COUNTROWS('Data'),
      FILTER(
         ALLEXCEPT('Data','Data'[Parameter]),[Sample Type]="TREATED WATER" OR "DISTRIBUTION"))
 
When I enter the above script to create a new measure in Desktop, I get the following error:  The syntax for 'OR' is incorrect. (DAX(CALCULATE(COUNTROWS('Data'),FILTER(ALLEXCEPT('Data','Data'[Parameter]),[Sample Type]="TREATED WATER" OR "DISTRIBUTION")))).
I've tried different syntax variations, but no luck getting it to work. Thanks
 
1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @pmcinnis 

try

res ct finished =
CALCULATE(
   COUNTROWS('Data'),
      FILTER(
         ALLEXCEPT('Data','Data'[Parameter]),[Sample Type]="TREATED WATER" || [Sample Type]="DISTRIBUTION"))

or

res ct finished =
CALCULATE(
   COUNTROWS('Data'),
      FILTER(
         ALLEXCEPT('Data','Data'[Parameter]),OR([Sample Type]="TREATED WATER", [Sample Type]="DISTRIBUTION")))

or

res ct finished =
CALCULATE(
   COUNTROWS('Data'),
      FILTER(
         ALLEXCEPT('Data','Data'[Parameter]),[Sample Type] IN {"TREATED WATER", "DISTRIBUTION"}))

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

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

Hi @pmcinnis 

try

res ct finished =
CALCULATE(
   COUNTROWS('Data'),
      FILTER(
         ALLEXCEPT('Data','Data'[Parameter]),[Sample Type]="TREATED WATER" || [Sample Type]="DISTRIBUTION"))

or

res ct finished =
CALCULATE(
   COUNTROWS('Data'),
      FILTER(
         ALLEXCEPT('Data','Data'[Parameter]),OR([Sample Type]="TREATED WATER", [Sample Type]="DISTRIBUTION")))

or

res ct finished =
CALCULATE(
   COUNTROWS('Data'),
      FILTER(
         ALLEXCEPT('Data','Data'[Parameter]),[Sample Type] IN {"TREATED WATER", "DISTRIBUTION"}))

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

Thanks!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors