Forum Discussion

ndj2212's avatar
ndj2212
New Member
1 year ago
Solved

Comparing measure and column value

Hi all,

 

I'm new to PBI and struggling to understand why this if statement isn't working. 

I want to check whether the selected filter value is present in another table (linked via a separate key). 

 

In this example, the value ID 87308 is selected by a page filter, and appears in this table using the SELECTED VALUE function in column "sel". I want to compare sel to Node1, but for some reason the if statements I've tried in columns "matched" and "M2" don't recognise that two values are the same. The Sel field is a measure (I think it has to be given that I'm using the selectedvalue function), and the Node1 field is a calculated column. 

 

Any tips on how to get this to work? 

Matched = if([sel]=[Node1], "Y", "N") only returns N values 

 

The two strings are identical, there isn't any whitespace. 

 

Many thanks! 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the replies from Chetan007 and HotChilli.

     

    Hi ndj2212 ,

     

    As HotChilli says, because calculated column are pre-calculated and stored, they do not react to dynamic changes in page filters or slicers. Calculated column remain the same no matter how you filter the data in your report.

     

    So you should create a measure instead of a calculated column, for example:

    Measure = IF(MAX([Node1])=[sel],"Y","N")

    Result:

    Best Regards,
    Zhu

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

6 Replies

  • Chetan007's avatar
    Chetan007
    Frequent Visitor

    Hii

     

    Column = IF('Table'[a]=='Table'[b],"Yes","NO")
    use == sign like this
    • ndj2212's avatar
      ndj2212
      New Member

      Thanks for your help, unfortunately that doesn't make a difference 

    • ndj2212's avatar
      ndj2212
      New Member

      matched is a column. I just need a text row-level column that is Y if the Node1 column matches the selected value ("sel") 

  • HotChilli's avatar
    HotChilli
    Community Champion

    This happens a lot. Calculated columns do not respond to slicers/filters.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for the replies from Chetan007 and HotChilli.

     

    Hi ndj2212 ,

     

    As HotChilli says, because calculated column are pre-calculated and stored, they do not react to dynamic changes in page filters or slicers. Calculated column remain the same no matter how you filter the data in your report.

     

    So you should create a measure instead of a calculated column, for example:

    Measure = IF(MAX([Node1])=[sel],"Y","N")

    Result:

    Best Regards,
    Zhu

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.