Power BI-SQL Server将多行合并为一个

时间:2019-06-24 14:48:19

标签: sql sql-server powerbi

我们正在尝试使用SQL Server中的数据在Power BI Desktop中汇总报表,但出现重复值问题。

enter image description here

上面的屏幕快照显示了该问题,我们有一个具有相同订单号的工作,其中完成了多个任务,但总价为一个。我们需要实现的是类似下面的内容。

enter image description here

基本上,我们每个工作编号只需查看一次成本。

任何对我们如何实现这一目标的帮助将不胜感激。

为澄清起见,我在下面的2个SQL示例中进行了“这是另一次尝试”

[Query="SELECT SMRID,VehicleAssetID,JobDate,JobDescription,AuthorisationAmount,Ordernumber,PartsCost,PostingAccessKey,Recharge,VAT FROM VIEW_DM_TEST_2 GROUP BY SMRID,VehicleAssetID,JobDate,AuthorisationAmount,NetCost,Ordernumber,PartsCost,PostingAccessKey,Recharge,VAT,JobDescription", HierarchicalNavigation=true])'

`

SELECT
  dbo.SMR.RecordID,
  dbo.SMR.VehicleAssetID,
  dbo.SMR.SupplierID,
  dbo.SMR.DateIn,
  dbo.SMR.OrderNumber,
  dbo.SMR.JobDate,
  dbo.SMR.AuthorisationDate,
  dbo.SMR.AuthorisationAmount,
  dbo.SMR.PartsCost,
  dbo.SMR.NetCost,
  dbo.SMR.GrossCost,
  dbo.SMR.VAT,
  dbo.SMRSummary.SMRID,
  dbo.SMRSummary.Recharge,
  dbo.SMRSummary.JobDescription,
  dbo.SMRSummary.Type,
  dbo.SMRSummary.PostingAccessKey,
  dbo.PostingDefinitionsView.ParentCode,
  dbo.PostingDefinitionsView.AccessCode,
  dbo.PostingDefinitionsView.MainDescription,
  dbo.PostingDefinitionsView.Active,
  dbo.PostingDefinitionsView.SubDescription,
  dbo.SMRSummary.NetCost AS Expr2
FROM dbo.SMR
CROSS JOIN dbo.SMRSummary
CROSS JOIN dbo.PostingDefinitionsView

`

0 个答案:

没有答案
相关问题