Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
brandonavants
New Member

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] = brandon@brandon.com I want [DepartmentRevised] to read Department A, bob@brandon.com to read Department B, and all the other departments that weren't blank to read their true department.  Thoughts?

1 ACCEPTED SOLUTION
malagari
Responsive Resident
Responsive Resident

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],
"brandon@brandon.com", "Department A",
"bob@brandon.com", "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."

 

Dan Malagari
Consultant at Headspring

View solution in original post

1 REPLY 1
malagari
Responsive Resident
Responsive Resident

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],
"brandon@brandon.com", "Department A",
"bob@brandon.com", "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."

 

Dan Malagari
Consultant at Headspring

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.