Power BI 具有多个列且没有日期列的运行总计
sql 中获取了以下数据
create table #tbl ([Group] varchar(10), [year] int, scenerio varchar(10), Total money)
insert into #tbl values
('Group1',2010,'Up',5),('Group1',2010,'Up',7),('Group3',2012,'Back',4),
('Group2',2016,'Front',10),('Group2',2014,'Back',12),('Group1',2015,'Front',7),
('Group2',2016,'base',10),('Group1',2017,'Up',11),('Group1',2018,'Up',10),
('Group3',2020,'Middle',5),('Group1',2020,'base',6),('Group1',2015,'Back',8),
('Group1',2015,'Back',2),('Group3',2020,'Middle',12)
select * from #tbl
drop table #tbl
我从power BI 中的 ,我为总计创建了一个 DAX SUM(Data[Total]
对于运行总计
Running Total = CALCULATE(
sum(Data[Total]),
ALLSELECTED(data),Data[year]<= MAX(Data[year]))
current Output
所需输出
I have the data below from sql
create table #tbl ([Group] varchar(10), [year] int, scenerio varchar(10), Total money)
insert into #tbl values
('Group1',2010,'Up',5),('Group1',2010,'Up',7),('Group3',2012,'Back',4),
('Group2',2016,'Front',10),('Group2',2014,'Back',12),('Group1',2015,'Front',7),
('Group2',2016,'base',10),('Group1',2017,'Up',11),('Group1',2018,'Up',10),
('Group3',2020,'Middle',5),('Group1',2020,'base',6),('Group1',2015,'Back',8),
('Group1',2015,'Back',2),('Group3',2020,'Middle',12)
select * from #tbl
drop table #tbl
in power BI i created a DAX for total SUM(Data[Total]
and for Running total
Running Total = CALCULATE(
sum(Data[Total]),
ALLSELECTED(data),Data[year]<= MAX(Data[year]))
current Output
Desired Output
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许:
Perhaps: