Forum Discussion

Sweetie's avatar
Sweetie
New Member
5 years ago

DAX

Hi experts, 

 

I am trying to compare whole table in

IF condition of DAX 

And it is not recognising.

If([Table name] <> 0, "yes","no")

Do we have any other way to compare entier table inside a DAX.

THANKS IN ADVANCE!

2 Replies

  • Sweetie , if this is a new column, then you can compare the value of the column at each row level

     

    if([column name] <> 0, "yes","no")

    • Sweetie's avatar
      Sweetie
      New Member

      Hi amitchandak 

       

      Your idea works for me, but actual scenario is to compare entier table.

       

      I have two things:

      1) Can we change datatype for directmode columns in power bi.

      Because I am trying to compare a column with 0(integer)

      If(sum[Column]<>0,"a/b",a)

      Trying to 

      change data type of column from text to whole number in Power Query Editor [As it was throwing me an error DAX COMPARISION OPERATORS DO NOT SUPPORT COMPARING values of TEXT with values of type integer]

      It still throws me same error!

       

       

      2) Can we compare entier table in if condition instead of single column of that perticular table

      If([Complete table] <> 0, "Yes", "NO")

      Dax isn't recognising this [Complete table]
      So what aggregation will we have to provide to the [Complete table] so that it would recognise and work fine for visuals.

      Please help me with this.