Forum Discussion
DAX - SelectColumns->Filter->Contains Syntax
It is good to know that PowerBI is trying to help me by automatically slamming a paran in there.
However, i am still get a syntax error. see the screenshot below.
Hi zamurr,
The syntax error here should be the Selectcolumns function Syntax error. When using Selectcolumns, the first parameter is a table expression, and after that there are pairs of parameters consisting of:
- A new column name
- An expression returning a column from the table given in the first parameter
Using Filter as the first parameter in your expression, Selectcolumns already have a table syntax, then the second ‘builds’ should be a new column name, but based on what has been posted, there are two table syntax here.
We may check the selectcolumns function with the following reference.
Using SelectColumns() To Alias Columns In DAX
Besides, could you please share about what you would like to achieve? Along with some data sample, we could offer some additional suggestions regarding DAX expression.
Please post back if any further assistance needed.
Regards
- zamurr9 years agoMicrosoft Employee
After my last post i realized that i needed to treat my DAX created table as the data table for the FILTER functions. Find the bold and underlined text to see my changes.
FlatTable = FILTER(SELECTCOLUMNS( build, "Index",build[Index], "MachineID",build[Machine], "UserAlias",build[Alias], "Branch",build[Branch], "Directory",build[StartPath], "BuildCommand",build[CommandLineString], "Razzle Cmd",build[Arguments], "Clean",build[Clean], "Parent",build[Parent], "BuildTime",build[BuildTime], "MachineType",LOOKUPVALUE(MachineInfo[Model],MachineInfo[MachineName],build[Machine]), "Manager",LOOKUPVALUE(Shell[Org_Mgr],Shell[Org_User],build[Alias]), "DM",LOOKUPVALUE(ShellDev[Org_DM],ShellDev[Org_User],build[Alias]), "DateTime",build[Time]), [Directory] = "shell")
- v-micsh-msft9 years agoMicrosoft Employee
Hi zamurr,
This one should work.
So what is your current situation?
Regards
- zamurr9 years agoMicrosoft Employee
It did not like the syntax. i actually moved on from this problem because i decided that i could filter with the slicers. I was hoping that creating a table using DAX would have made my querying faster, but that doesn't seem to be the case.
- zamurr9 years agoMicrosoft Employee
I am new to DAX, so I am working my way through a complex problem. I am looking to create a table from columns in other tables. Here is the description of what I am trying to do
http://community.powerbi.com/t5/Desktop/Combine-multiple-tables-into-one-table/m-p/60752#M24933
I understand the SelectColumns, but what i dont understand is how to implement filtering. I want to filter out data before i create my table.
Do i want to filter on the outside of the DAX query?
- Michaeldias3 years agoHelper I
Had the same problem but the solution seemed straight forward after reading up the documentation.
Table 1 = Column1 with values A,B,CThe following gives all of Table 1 as new Table 2
Table 2 =
SELECTCOLUMNS( 'Table 1'
, "Column 1 Alias", [Column 1]
)The following gives all of Table 1 without "A" as new filter Table 3 as the result of FILTER is a table
Table 3 =
SELECTCOLUMNS( FILTER ( 'Table 1', 'Table 1'[Column 1] <> "A" )
, "Column 1 Alias", [Column 1]
)