Forum Discussion

brandonavants's avatar
brandonavants
New Member
9 years ago
Solved

Need Help with Dax formula

I'm new to the DAX formula world and I cannot figure out a logic statement I was hoping someone could assist.  

 

So, in english I want to evaluate a field called [Department] to see if it is blank and if it is I then want to look at the [Created By] email address.  The final part is if [Created By] = [email protected] I want [DepartmentRevised] to read Department A, [email protected] to read Department B, and all the other departments that weren't blank to read their true department.  Thoughts?

  • Are you trying to make a new column that is conditional, based on columns within the same table?  If so, you should be able to do something like this:

     

     

    NewColumn = IF( ISBLANK( [Department] ), 
    [Created By], SWITCH( [Created By],
    "[email protected]", "Department A",
    "[email protected]", "Department B",
    [Department]
    )
    )

     

    This is essentially saying "If Department is blank, show the CreatedBy email address.  Otherwise, look at the CreatedBy email address.  If it's brandon, return Department A.  If it's bob, return Department B.  If it's not equal to brandon or bob, return the original Department."

     

1 Reply

  • malagari's avatar
    malagari
    Continued Contributor

    Are you trying to make a new column that is conditional, based on columns within the same table?  If so, you should be able to do something like this:

     

     

    NewColumn = IF( ISBLANK( [Department] ), 
    [Created By], SWITCH( [Created By],
    "[email protected]", "Department A",
    "[email protected]", "Department B",
    [Department]
    )
    )

     

    This is essentially saying "If Department is blank, show the CreatedBy email address.  Otherwise, look at the CreatedBy email address.  If it's brandon, return Department A.  If it's bob, return Department B.  If it's not equal to brandon or bob, return the original Department."