Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Condition Combining columns

Hi All, 

 

I have a data set that looks something like this:

MinimumMaximum
1 
5 
36
 7
24

 

 I want to create a new column in DAX so that the data will look something like this:

MinimumMaximumNew Column
1 >=1
5 >=5
363<=>6
 7<=7
242<=>4

 

Is there any way to do this in DAX using a formula? Need help with it. Thanks a lot for the help.

  • Hi Anonymous 

    New column =
    SWITCH (
        TRUE (),
        NOT ISBLANK ( Table1[Minimum] ) && NOT ISBLANK ( Table1[Maximum] ),
            Table1[Minimum] & "<=>" & Table1[Maximum],
        NOT ISBLANK ( Table1[Minimum] ), ">=" & Table1[Minimum],
        NOT ISBLANK ( Table1[Maximum] ), "<=" & Table1[Maximum]
    )

     

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

3 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous 

    New column =
    SWITCH (
        TRUE (),
        NOT ISBLANK ( Table1[Minimum] ) && NOT ISBLANK ( Table1[Maximum] ),
            Table1[Minimum] & "<=>" & Table1[Maximum],
        NOT ISBLANK ( Table1[Minimum] ), ">=" & Table1[Minimum],
        NOT ISBLANK ( Table1[Maximum] ), "<=" & Table1[Maximum]
    )

     

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers 

     

  • AilleryO's avatar
    AilleryO
    Memorable Member

    Hi,

     

    You can use those functions to do the trick.

    IF or SWITCH functions to test

    ISBLANK([mini]) and ISBLANK([maxi]) to check if you have a value or not.

    and finaly CONCATENATE (or uing &) with ">=" and "<=" symbols.

     

    Hope it helps

  • Anonymous , Create a new column like

     

    Switch( true(),
    isblank([Maximum]) , ">=" & [Minimum] ,
    isblank([Minimum]) , "<=" & [Maximum] ,
    [Minimum] & "<=>" & [Maximum]
    )