Forum Discussion
DAX if else problems
Anonymous
I formatted the code bit so that we see clearly the three conditions you have (in red) and the corresponding result (in green)
hourly rate DEV =
SUMX (
'Stundensätze';
IF (
C1 'Stundensätze'[Key] = 'Zeiteinträge'[Key] && 'Zeiteinträge'[Date] > 'Stundensätze'[start] && 'Zeiteinträge'[Date] < 'Stundensätze'[end];
R1 'Stundensätze'[value];
IF (
C2 'Zeiteinträge'[Project] = 'Stundensätze'[Key];
R2 'Stundensätze'[value];
IF (
C3 'Zeiteinträge'[Customer] = 'Stundensätze'[Key] && 'Zeiteinträge'[Date] > 'Stundensätze'[start] && 'Zeiteinträge'[Date] < 'Stundensätze'[end];
R3 'Stundensätze'[value]
)
)
)
)I'm quoting you:
My understanding is that if one row falls to condition 1 the if clause should stop even if e.g. Condition 3 would also be correct for this row. But in my DAX for "hourly rate DEV" its not working like that.
What do you mean exactly? Can you try to explain this again? I don't quite get it.
If the condition 1 isn't met, the first IF continues to check the second IF, since that is what you have as result for the condition not being met (specified as third parameter of the first IF). It does NOT stop.
Anonymous
Does it make sense that you have 'Stundensätze'[value] always, in all three IFs?
S, regardless of which condition is met C1, C2 or C3, you take 'Stundensätze'[value] as value to add in the SUMX?