Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Concatenate if field if not null?

I have a new column created using this formula:

Const Year-Quarter = CONCATENATE('Properties'[Const-Y]&"-", "Q"&'Properties'[Const-Q])
 
I would like to update this formula to concatenate If Const-Y is not null. If Const-Y is null, then return blank. 
 
Lil help? 🙂 

2 Replies

  • Hi Anonymous 

    you can pretty easily have an IF statement within your CONCATENATE like:

     

    Const Year-Quarter =
    CONCATENATE (
        IF ( NOT ISBLANK ( 'Properties'[Const-Y] ), 'Properties'[Const-Y] ) & "-",
        "Q" & 'Properties'[Const-Q]
    )

  • Anonymous's avatar
    Anonymous
    Not applicable

     

    [Const Year-Quarter] =
    var Year_ = Properties[Const-Y]
    var Quarter_ = Properties[Const-Q]
    RETURN
        if(
            NOT ISBLANK( Year_ ),
            Year_ & "-Q" & Quarter_
        )