Power BI:总数。记录(S.No)在执行CSV并集时汇总

时间:2018-11-08 19:43:02

标签: powerbi powerbi-desktop

我有40-50个不同城市的csv文件。我想显示按城市和主题标签过滤的整个时间的n 记录总数

  1. 'S.No'被汇总并显示记录的总和(我不明白为什么会显示总和,在执行Union时不应该是单个记录的编号吗?)即,即使单个文件中有S.No 1-50,决赛桌应该显示1-2500的S.No。但事实并非如此。

下图显示了查询编辑器中的数据。

enter image description here

此图在“数据表视图”中显示具有汇总总和的表 enter image description here

我们看到, S.No 显示为汇总。

enter image description here

更新:

从高级编辑器粘贴查询:

let
    Source = Folder.Files("C:\Users\Desktop\data collection\twitter_new_count"),
    #"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
    #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File from twitter_new_count", each #"Transform File from twitter_new_count"([Content])),
    #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
    #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File from twitter_new_count"}),
    #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from twitter_new_count", Table.ColumnNames(#"Transform File from twitter_new_count"(#"Sample File"))),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"", Int64.Type}, {"ttext", type text}, {"date", type datetime}, {"isretweet", type logical}, {"retweetcount", Int64.Type}, {"favoritecount", Int64.Type}, {"score", Int64.Type}, {"term", type text}, {"city", type text}, {"country", type text}, {"duplicate", type logical}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each true),
    #"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"", "S.No"}}),
    #"Inserted Date" = Table.AddColumn(#"Renamed Columns", "Date.1", each DateTime.Date([date]), type date),
    #"Inserted Time" = Table.AddColumn(#"Inserted Date", "Time", each DateTime.Time([date]), type time),
    #"Renamed Columns2" = Table.RenameColumns(#"Inserted Time",{{"date", "Datentime"}, {"Date.1", "Date"}}),
    #"Added Index" = Table.AddIndexColumn(#"Renamed Columns2", "Index", 0, 1),
    #"Removed Columns" = Table.RemoveColumns(#"Added Index",{"Index"}),
    #"Added Index1" = Table.AddIndexColumn(#"Removed Columns", "Index", 1, 1),
    #"Renamed Columns3" = Table.RenameColumns(#"Added Index1",{{"Index", "Row Number"}}),
    #"Inserted Hour" = Table.AddColumn(#"Renamed Columns3", "Hour", each Time.Hour([Datentime]), Int64.Type),
    #"Filtered Rows1" = Table.SelectRows(#"Inserted Hour", each true),
    #"Renamed Columns4" = Table.RenameColumns(#"Filtered Rows1",{{"Hour", "Hour of Day"}})
in
    #"Renamed Columns4

1 个答案:

答案 0 :(得分:0)

我很确定数据表视图中的这些S.No值不是 聚合的,但是它们的排序方式与查询编辑器视图中的排序方式不同。检查总行数以确保。