DAX创建具有特定列名且没有行的空表 [英] DAX create empty table with specific column names and no rows

查看:295
本文介绍了DAX创建具有特定列名且没有行的空表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建具有指定列名且完全没有行的表。以下oneliner可以满足我的要求,但显示错误消息,即ROW函数中应该有第二个参数。

How to create a table with a specified column name and no rows at all. The following oneliner does what I want but shows error message that there should be second argument in ROW function.

EmptyTable = ROW ("Product")

我想用它来制作具有所需列名的桥表。例如,我希望Product_bridge表具有列 Product。

I would like to use it for making bridge tables with desired column name. For example I want Product_bridge table to have a column "Product".

Product_bridge = DISTINCT(
    UNION(
         DISTINCT(      Sales[Prod_Name]        ) 
        ,DISTINCT( Dictionary[Prod_DifferntName])
        ,DISTINCT(  PriceList[P]                )
        ))

上面的代码为我提供了第一个表的名称,在本例中为Prod_Name。

The code above gets me the name of the first table, in this case Prod_Name.

推荐答案

您可以过滤它。或选择TOPN 0。

You could just filter it. Or select TOPN 0.

TOPN:

Table = TOPN(0;DATATABLE("Product";STRING;{{}}))

过滤器:

Table = FILTER(DATATABLE("Product";STRING;{{}});0)

这篇关于DAX创建具有特定列名且没有行的空表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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