Forum Discussion

nirvana_moksh's avatar
nirvana_moksh
Impactful Individual
8 years ago
Solved

DAX Involving TRUE/FALSE Column

Hello Community,

 

How do you deal with writing a DAX Statement that invloves a column that is of data type TRUE/FALSE without converting it to text and making it to work?

 

 

Thank You

  • v-yulgu-msft's avatar
    v-yulgu-msft
    8 years ago

    Hi nirvana_moksh,

     

    Maybe you need something similar to below. Here [Column1] comtains 'TRUE/FALSE' data type values.

    New column = 
    IF ( Table[Column1] = TRUE (), 1, 0 )

    Regards,

    Yuliana Gu

     

7 Replies

    • nirvana_moksh's avatar
      nirvana_moksh
      Impactful Individual

      So I was using a calculated IF statement and it was using a column which was 'TRUE/FALSE' data type and for some reason the DAX did not recognize that and I had to convert that column to Text for it to work

      • v-yulgu-msft's avatar
        v-yulgu-msft
        Microsoft Employee

        Hi nirvana_moksh,

         

        Maybe you need something similar to below. Here [Column1] comtains 'TRUE/FALSE' data type values.

        New column = 
        IF ( Table[Column1] = TRUE (), 1, 0 )

        Regards,

        Yuliana Gu

         

    • idkwhatimdoing's avatar
      idkwhatimdoing
      Advocate I

      besides, you don't have to create a column or measure to count the #'s of true/false fields. Just use counta in a measure:

      CALCULATE(
          COUNTA('Table'[Column]),
          'Table'[Column] IN { TRUE() }