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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TechR21
Helper V
Helper V

"AND" statement DAX

Hi ,

 

Im trying to have a column containing either 1 or 0 depending on following condition in DAX:

 

"OpenIncident", IF ( AND(
        CALCULATE (
            COUNTROWS ( 'tableA' ),
            ALLEXCEPT (
                'tableA',
                'tableA'[SubGroup],
                'tableA'[incidentNumber]
            ),
            'tableA'[Change Status] in {"Logged", "Waiting", "Updated"})
           ,
 
        CALCULATE (
            COUNTROWS ( 'tableA' ),
            ALLEXCEPT (
                'tableA',
                'tableA'[SubGroup],
                'tableA'[incidentNumber]
            ),
            
            'tableA'[Status Name] in {"Logged", "Updated","In progress"})
 
        ) > 0,
        1,
        0
        )
)
 
So if both statements are true, it should give me a "1" in the column, otherwise "0"
 
 
I keep getting following error but cant seem to make it work:
DAX comparison operations do not support comparing values of type True/False with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values.
1 ACCEPTED SOLUTION
Shubham_Tekade
Frequent Visitor

Hello,

 

"OpenIncident", IF ( AND(
        CALCULATE (
            COUNTROWS ( 'tableA' ),
            ALLEXCEPT (
                'tableA',
                'tableA'[SubGroup],
                'tableA'[incidentNumber]
            ),
            'tableA'[Change Status] in {"Logged", "Waiting", "Updated"})
           ,
 
        CALCULATE (
            COUNTROWS ( 'tableA' ),
            ALLEXCEPT (
                'tableA',
                'tableA'[SubGroup],
                'tableA'[incidentNumber]
            ),
            
            'tableA'[Status Name] in {"Logged", "Updated","In progress"})
 
        ) ,-- This will giving you true/ flase in output and here you are trying to compare with like (True/false)>0. this will not work.
        1,
        0
        )
 
try this it will work for you I think so.
 
thanks.
 
 
 

View solution in original post

2 REPLIES 2
Shubham_Tekade
Frequent Visitor

Hello,

 

"OpenIncident", IF ( AND(
        CALCULATE (
            COUNTROWS ( 'tableA' ),
            ALLEXCEPT (
                'tableA',
                'tableA'[SubGroup],
                'tableA'[incidentNumber]
            ),
            'tableA'[Change Status] in {"Logged", "Waiting", "Updated"})
           ,
 
        CALCULATE (
            COUNTROWS ( 'tableA' ),
            ALLEXCEPT (
                'tableA',
                'tableA'[SubGroup],
                'tableA'[incidentNumber]
            ),
            
            'tableA'[Status Name] in {"Logged", "Updated","In progress"})
 
        ) ,-- This will giving you true/ flase in output and here you are trying to compare with like (True/false)>0. this will not work.
        1,
        0
        )
 
try this it will work for you I think so.
 
thanks.
 
 
 

yes this works. After reading the error again I figured something with the last part should be wrong. thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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