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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors