从 PBI 数据集创建表 - 不同的计数和单独的字段计数 [英] create table from PBI dataset - distinct count and separate field counts

查看:7
本文介绍了从 PBI 数据集创建表 - 不同的计数和单独的字段计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张表,其中包含 PBI 数据集中的一组任务、tasker 和状态.如何从这些数据创建一个单独的表到一组不同的任务,其中任务者的数量和状态在单独的列中.

I have a table with a set of tasks, tasker and status in a PBI dataset. how can I create a separate table from this data to a set of distinct tasks with counts of taskers and status in separate columns. sample

Tried potential solution but ended up with an error message

解决方案

Although you can do it using DAX, I would prefer to do it in Power Query Editor using M. Just create a new table using the below Advance Editor code.

Note: Change the source_table_name with your original table name.

let
    Source = source_table_name,
    #"Grouped Rows" = 
        Table.Group(
                Source, 
                {"Task"}, 
                {
                    {"count of tasker id", each Table.RowCount(_), Int64.Type}, 
                    {"status = completed", 
                        each Table.RowCount(
                            Table.SelectRows(_,each [Status] = "completed")
                        ), Int64.Type
                    }, 
                    {"status = incomplete", 
                        each Table.RowCount(
                            Table.SelectRows(_,each [Status] = "incomplete")
                        ), Int64.Type
                    }
                }
            )
in
    #"Grouped Rows"

Here is the output-

这篇关于从 PBI 数据集创建表 - 不同的计数和单独的字段计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆