Forum Discussion
Anonymous
1 year agoNot applicable
Switch function with If statement
Hello community, I need your help with rewriting switch function with If statement. Below is my current code Coke Goal =
VAR _7D=MAX(table 1[DATE])-7
VAR _30D=MAX(table 1[DATE])-30
VAR _365D...
- Anonymous1 year ago
Hi Anonymous ,
Maybe you can try formula like below to create calculated column:
Coke Value = SWITCH ( TRUE (), 'Table'[Days Open] < 365, 'Table'[Days Open] * 'Table'[Coke Goal], 'Table'[Days Open] >= 365, 365 * 'Table'[Coke Goal] )Best Regards,
Adamk KongIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
1 year agoNot applicable
lbendlin Just to clarify
"You will not be able to distinguish between "more than 365 days" and "else"
| Site | Days Open | Coke Goal |
| 1 | 35 | 1 |
| 2 | 200 | 0.5 |
| 3 | 15 | 2.5 |
| 4 | 400 | 2 |
| Site | Coke Value |
| 1 | |
| 7d | 7 (7* goal) |
| 30d | 30 (30 * goal) |
| 365d | 35 ( Since days open is less than 365, I want the goal * days open) |
| 4 | |
| 7d | 14 |
| 30d | 60 |
| 365d | 730( since the days open is over 365, I want 365 * the goal) |
This is what I'm trying to acheive.
- lbendlin1 year agoSuper User
You lost me a bit here. Are you trying to apply multiple rules at the same time?