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 )
First, use a SWITCH(TRUE()...) statement instead of nested IF statements. Far cleaner, more readable and easier to modify. Second, use the logical operators && (AND) and || (OR) to combine multiple criteria.
thanks for the reply. Rather new to Power BI so trying to learn how to accomplish various tasks. I just replied to another user who suggested somewhat the same as you, but he had the same value for both John and Jane Doe. I need to have it so that John has a value of 65, Jane a value of 40 and all other PE's a value of 50. Not sure how to accomplish this with the info you provided.
thanks for your input.