cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tb__ Frequent Visitor
Frequent Visitor

Can't use DAX and column/field with underscore/dashes in it

I merged two tables. They each have underscores and dashes in their name. The resultant merged table now has underscores in some field names. When I try now to match that new field with another, I get a DAX syntax error message pointing to, not the whole column name, but just up to the first dash. 

 

I tried renaming the column before referencing it in DAX but that apparently doesn't work. I see "Expression.Error: A cyclic reference was encountered during evaluation" but it does not indicate where this cyclical reference is.

 

code (changed var/table/file names) - 

 

let
    Source = Table.NestedJoin(#"table_with-underscores_and-dashes.tsv",{"RawGUID"},#"other-.tsv",{"GUID"},"other-",JoinKind.LeftOuter),
    #"Expanded other_table-with_underscores-and_dahses" = Table.ExpandTableColumn(Source, "other_table.tsv", {"GUID", "Date", "url", "StringToCheck"}, {"other-.GUID", "other-.Date", "other-.url", "other-.StringToCheck"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded other-", each [#"other-.StringToCheck"] <> null and [#"other-.StringToCheck"] <> ""),
    #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each [StringToCheck] <> null and [StringToCheck] <> ""),
    #"Renamed Columns" = Table.RenameColumns(SameLabeles,{{"other-.StringToCheck", "stc"}}),
    #"SameLabeles" = Table.SelectRows(#"Renamed Columns", each Comparer.Equals(Comparer.Ordinal, [StringToCheck], [stc]))
in
    #"SameLabeles"

1 ACCEPTED SOLUTION

Accepted Solutions
tb__ Frequent Visitor
Frequent Visitor

Re: Can't use DAX and column/field with underscore/dashes in it

AH so the issue is that earlier in the code I referenced "SameLabeles" (in #"Renamed Columns") and then I declare #"SameLabeles". Why can't powerBI point this out?

2 REPLIES 2
v-huizhn-msft Super Contributor
Super Contributor

Re: Can't use DAX and column/field with underscore/dashes in it

Hi @tb__,

>>When I try now to match that new field with another, I get a DAX syntax error message pointing to, not the whole column name, but just up to the first dash. I tried renaming the column before referencing it in DAX but that apparently doesn't work.

How do you match that new field with another? And what your DAX looks like? Could you please share more details for further analysis?

Best Regards,
Angelia

tb__ Frequent Visitor
Frequent Visitor

Re: Can't use DAX and column/field with underscore/dashes in it

AH so the issue is that earlier in the code I referenced "SameLabeles" (in #"Renamed Columns") and then I declare #"SameLabeles". Why can't powerBI point this out?