Forum Discussion

mheagerty's avatar
mheagerty
Frequent Visitor
1 year ago
Solved

DAX IF formula for 'numeric range paramater'

Hi, complete noobie here.

I have created a slider/visual using a 'numeric range paramater', where i can select/enter from the range provide (e.g. 1-100)

Im trying to create a new column for my table that uses an IF (less than, greater than) statement between the paramater value and another column in the table. Example:

Test = IF('Parameter'[Paramater Value] < 'Table'[Column],"True","False")

But this doesnt work, no matter what i select in the paramter as a value

If i dont use the paramater, it works fine

Test = IF('Table'[Column] < 0.6,"True","False")

Any help would be appreciated 🙂


  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi mheagerty 

     

    The HotChilli advice is sound.

     

    If you want 'Table'[Column] to output values based on the slicer's selection, you should use Measure, not Column.

     

    And your slicer is a range, which is why your dax doesn't work.

     

    You can extract values from the slicer, such as minimum values:

     

    Create a measure.

     

    Test = 
    var _parameter = MIN('Parameter'[Parameter Value])
    var _column = SELECTEDVALUE('Table'[Column])
    RETURN 
    IF(_parameter < _column, "True", "False")

     

    Here is the result.

     

     

    Regards,

    Nono Chen

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

     

     

3 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    You can write a measure for this but you can't use a calculated column. They don't change in response to slicers.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi mheagerty 

     

    The HotChilli advice is sound.

     

    If you want 'Table'[Column] to output values based on the slicer's selection, you should use Measure, not Column.

     

    And your slicer is a range, which is why your dax doesn't work.

     

    You can extract values from the slicer, such as minimum values:

     

    Create a measure.

     

    Test = 
    var _parameter = MIN('Parameter'[Parameter Value])
    var _column = SELECTEDVALUE('Table'[Column])
    RETURN 
    IF(_parameter < _column, "True", "False")

     

    Here is the result.

     

     

    Regards,

    Nono Chen

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

     

     

  • mheagerty's avatar
    mheagerty
    Frequent Visitor

    Anonymous HotChilli  Thank you so much for providing this inofrmation, and in such detail.
    This has worked perfectly, and I have also added a second parameter/variable for my measure 🙂