PowerBI - 计算每日百分比回报和累积回报
我试图找出一种在PowerBI中计算/可视化ETF价格(收盘价)累积百分比变化的方法,这样我就可以创建折线图并过滤日期范围(即使用时间线切片器选择不同的时期,以便我可以显示 1 个月/一年至今的累积变化等)。
实际上,我正在尝试计算“收盘价”列中的累积百分比变化,但是我有多个 ETF(因此“交易品种”列有超过 1 个 ETF),这意味着每只 ETF 都需要有不同的“最低收盘价”。我希望能够每天这样做,这样我就可以生成折线图来可视化数据。
我已经尝试过几种方法来做到这一点,如果有帮助的话,我很乐意提供详细信息,但我发布的这种信息告诉您我是如何(不)成功的...对 PowerBI/DAX 相当陌生,所以非常感谢您的帮助。
I am trying to figure out a way of calculating/visualizing the cumulative percentage change in price (close price) of an ETF in PowerBI, such that I can create a line chart and filter the date range (i.e. select different periods with timeline slicer so I can show cumulative change over 1 month/year-to-date etc).
Effectively, I am trying to calculate the cumulative percent change in column 'close', however I have multiple ETFs (so column 'Symbol' has more than 1 ETF), and this means that there will need to be a different 'minimum close price' per ETF. I would like to be able to do this daily so I can produce a line chart to visualize the data.
I have tried doing this a few ways, am happy to provide details if helpful but me posting this sort of tells you how (un)successful I have been... Quite new to PowerBI/DAX so would really appreciate the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是添加按符号分组的列的一种方法,然后添加具有百分比变化的列(基于
(currentClose-previousClose)/previousClose
。List.Generate
生成百分比变化值数组Here's one way of adding a column which groups by Symbol, and then adds a column which has the percent change (based on
(currentClose-previousClose)/previousClose
.List.Generate
generates the array of percentage change values