Forum Discussion

Stuznet's avatar
Stuznet
Icon for Helper V rankHelper V
7 years ago
Solved

Concatenation or Combinevalues with Conditional

Hi guys,
I have 3 columns: Month, Day, Year when I combined them together

Column = [Month] &”/“& [Day] &”/“& [Year]

it gave me the result what I wanted but the new column contains blank with combined value of “/“ .
How do I write a conditional if concantenate is blank do not include “/“ symbol.

Really appreciated if someone can help me out.
  • Stuznet,

     

    DAX Solution:

     
    DAX = 
    IF (
        Table1[Month] = BLANK() || Table1[Day] = BLANK() || Table1[Year] = BLANK (),
        BLANK (),
        COMBINEVALUES ( "/", Table1[Month], Table1[Day], Table1[Year] )
    )
     You could wrap the FALSE statement inside of DATEVALUE to convert the TEXT string into a DATE type as below.
    DAX = 
    IF (
        Table1[Month] = BLANK() || Table1[Day] = BLANK() || Table1[Year] = BLANK (),
        BLANK (),
        DATEVALUE ( COMBINEVALUES ( "/", Table1[Month], Table1[Day], Table1[Year] ) )
    )
     
     
     

     

     

2 Replies

  • ChrisMendoza's avatar
    ChrisMendoza
    Icon for Resident Rockstar rankResident Rockstar

    Stuznet,

     

    DAX Solution:

     
    DAX = 
    IF (
        Table1[Month] = BLANK() || Table1[Day] = BLANK() || Table1[Year] = BLANK (),
        BLANK (),
        COMBINEVALUES ( "/", Table1[Month], Table1[Day], Table1[Year] )
    )
     You could wrap the FALSE statement inside of DATEVALUE to convert the TEXT string into a DATE type as below.
    DAX = 
    IF (
        Table1[Month] = BLANK() || Table1[Day] = BLANK() || Table1[Year] = BLANK (),
        BLANK (),
        DATEVALUE ( COMBINEVALUES ( "/", Table1[Month], Table1[Day], Table1[Year] ) )
    )