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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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 Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Top Solution Authors