简体   繁体   中英

How to select N columns from a PowerBI table?

I have the following table with three columns A, B, and C on PowerBI, from which I want to select columns A and B to create a new table.

And looking from the equivalent in Pandas to:

table_2 = table1[["A","B"]]

or from SQL:

SELECT A,B FROM table1;

But I'm not finding the equivalent function on Power BI; the SELECTCOLUMNS function is used to create a new column as stated in the docs:

Adds calculated columns to the given table or table expression.

The SELECTCOLUMNS function works fine for this. It allows you to create more complex calculated columns, but you can simply use the column itself as the calculation definition.

This should do the trick:

SELECTCOLUMNS(table1, "A", table1[A], "B", table1[B])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM