Forum Discussion
IF Statement help with multiple variables
- 6 years ago
I started with the dataset below. Because I edited the file it reordered the columns.
[Value] is a Calculated Column.
Adding [RateType] is just a suggestion. You can accomplish what you asked (not adding a helper column) by doing:
Value = SWITCH( TRUE(), 'Table'[Name] = "John Doe" && 'Table'[Title] = "Project Executive", 65, 'Table'[Name] = "Jane Doe" && 'Table'[Title] = "Project Executive", 45, 'Table'[Title] = "Project Executive", 50, 25 )
Edit: Same idea after I re-read your requirement
I would probably just add a helper flag column to your dataset instead of hard-coding Name values.
Value =
SWITCH(
TRUE(),
'Table'[RateType] = 1 && 'Table'[Title] = "Project Executive", 65,
'Table'[RateType] = 2 && 'Table'[Title] = "Project Executive", 45,
'Table'[Title] = "Project Executive", 50,
25
)
Thanks for the reply. I am rather new to Power Bi so trying to learn DAX. can be a bit confusing. Based on your reply, you have the same value for John and Jane Doe. In my original post, Jane Doe has a different value from John and from the other PE's. In my current dataset, my IF statement has multiple nested IF statements due to numerous job titles. This works great, until today when my boss emailed me with changes for just a few users. Previously all users with same job title has same value. now i need John Doe to have one value (65), Jane Doe to have a value of 40 and all other PE's to have a value of 50.
thanks for your help.