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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
pmcinnis
Helper III
Helper III

How do I change DAX script to count things differently?

The table below titled 'Desired Output' shows the output I want. It's produced from the data in tables 'Results' and 'Guidelines'. 'Results' is a table of chemical concentration results. The column 'result type' is the type of sample from which the concentrations are measured. 'Guidelines' is a table of health guidelines for the various chemicals. Concentrations should be below the guidelines for public safety. 'Desired Output' counts the number of results (for each result type for each chemical) that are equal to or over the guideline and equal to or over 1/2 the guideline.

 

Annotation 2020-01-13 113206.jpg

 

The DAX script I'm using doesn't quite give me the above Desired Output table. Instead it gives me the Output table below. It counts results for chemicals f and g even though chemicals f and g don't have a guideline to compare to.

 

Annotation 2020-01-10 162458.jpg

 

Below is the DAX script I'm using. I use it to create six measures which I use to create the above table visuals. I modify the script as needed to create separate measures for result types R, T and D, as well as for comparing results to the guideline and 1/2 the guideline:

 

Annotation 2020-01-10 160554.jpg

My question is: How do I modify the above DAX script to not count results for chemicals that don't have guidelines such as chemicals f and g?

 

Thanks in advance

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@pmcinnis 

 

You may add IF as follows.

IF (
    NOT (
        ISBLANK (
            CALCULATE (
                SELECTEDVALUE ( GUIDELINES[guideline] ),
                CROSSFILTER ( RESULTS[name], GUIDELINES[name], BOTH )
            )
        )
    ),

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@pmcinnis 

 

You may add IF as follows.

IF (
    NOT (
        ISBLANK (
            CALCULATE (
                SELECTEDVALUE ( GUIDELINES[guideline] ),
                CROSSFILTER ( RESULTS[name], GUIDELINES[name], BOTH )
            )
        )
    ),

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.