Beast Mode Case Statement Summing multiple rows with multiple conditions
DiLeo
⚪️
SUM((CASE WHEN `STORE_NUMBER`= 1 AND (YEARWEEK(SUBDATE(`FULL_DATE`, interval 1 day)))=YEARWEEK(CURRENT_DATE())-2 then `ESALES`)) else SUM((CASE WHEN `STORE_NUMBER`= 2 AND (YEARWEEK(SUBDATE(`FULL_DATE`, interval 1 day)))=YEARWEEK(CURRENT_DATE())-2 then `ESALES` END))
This works for the first store when I do that bit alone, but as soon as I add the second part in an else statement it doesn't work. This needs to be done for several stores and ideally I'd do something like this and keep adding else statements.
Tagged:
0
Categories
- 7.3K All Categories
- 13 Getting Started in the Community
- 141 Beastmode & Analytics
- 1.8K Data Platform & Data Science
- 54 Domo Everywhere
- 2K Charting
- 1K Ideas Exchange
- 903 Connectors
- 236 Workbench
- 342 APIs
- 77 Apps
- 19 Governance & Productivity
- 235 Use Cases & Best Practices
- 50 News
- 473 Onboarding
- 572 日本支部