tableau-api - Tableau GAP & 预测公式 & 按月+季度显示
问题描述
我有 excel 数据源(如下所示),我想将 4 个计算字段 (CF) 显示为(红色突出显示),以黄色突出显示 4 个“团队”。所需输出以绿色突出显示。
我得到的输出如图所示:
面临的问题:
- 无法找到预测和 GAP 的正确答案。使用的公式如下:
如何仅按月表示(销售数量),但在 QUARTER 级别显示所有 4 个 CF,如上图绿色所示。
# of sales = COUNT([Productname]) Days Passed = DAY([Sale Date])-day(TODAY()) Forecast = (([#ofSales]))/(avg([DaysPassed]))*avg([TotalDays]) SalesTarget (copy) = { FIXED [Team], quarter([Sale Date])=1 : avg([SalesTarget])} GAP = (sum([SalesTarget (copy)]))-[Forecast] TotalDays = if quarter([Sale Date])=1 then 91 ELSEIF quarter([Sale Date])=2 then 92 ELSEIF quarter([Sale Date])=3 then 92 ELSEIF quarter([Sale Date])=4 then 92 end SalesTarget = if [Team]="USA Small" and quarter([Sale Date])=1 then 10 ELSEIF [Team]="USA Big" and quarter([Sale Date])=1 then 5 ELSEIF [Team]="UK Small" and quarter([Sale Date])=1 then 3 ELSEIF [Team]="UK Big" and quarter([Sale Date])=1 then 3 END SalesTarget (copy) = { FIXED [Team], quarter([Sale Date])=1 : avg([SalesTarget])}
我尝试了多种解决方法,但找不到解决方案。我无法在 Stack Overflow 中附加任何文件。所以只添加了几个代码示例,我尝试了很多。
解决方案
推荐阅读
- javascript - 如何在 Django 中使用 AJAX GET/POST 方法在列表中发送大数据
- ios - 使用 RevenueCat 的应用程序在审核中被拒绝
- python - Selenium 循环直到找到属性
- python - 将csv中的逗号更改为分号
- python - Python列表或字典?
- javascript - 使用 Redux 更新 TypeScript React 功能组件的问题
- ios - 暂停后显示倒计时的标签有时会不同步。舍入错误?
- ios - 使用组合具有不同值类型的简单 Future 链接
- linux - 从哪里获得 XLib 或 X11 的手册页
- excel - 从组合框中选择后从网页中获取 href