<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Removing square brackets from column headers DAX query in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1422029#M26041</link>
    <description>&lt;P&gt;Ah yes so, as my code is above the table name precedes&amp;nbsp;the column name in the square brackets. However, I've used SELECTCOLUMNS to get around this, so the script is now (first five columns as an example in the DAX query);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient") 

$PowerBIEndpoint = "REDACTED"
$PowerBILogin = ""
$PowerBIPassword = ""

$Query = 
"EVALUATE
SELECTCOLUMNS (
    SUMMARIZECOLUMNS (
        'XactlyTemplate'[Performance Month],
        'XactlyTemplate'[Invoice Number1],
        'XactlyTemplate'[Transaction Date],
        'XactlyTemplate'[Customer Unique ID],
        'XactlyTemplate'[Customer Name],
        'XactlyTemplate'[Customer State],
        'XactlyTemplate'[Customer Region],
        'XactlyTemplate'[ContractID],
        'XactlyTemplate'[Contract Start Date],
        'XactlyTemplate'[Contract End Date],
        'XactlyTemplate'[Order/Contract Term in Months],
        'XactlyTemplate'[Order/Contract Term in Days],
        'XactlyTemplate'[Usage Type],
        'XactlyTemplate'[AcctAssignGroup],
        'XactlyTemplate'[Revenue Type],
        'XactlyTemplate'[Transaction Type Description],
        'XactlyTemplate'[Stock_Material Code],
        'XactlyTemplate'[Stock_Material Code Description],
        'XactlyTemplate'[Product Name],
        'XactlyTemplate'[Sub-Product],
        'XactlyTemplate'[Recurring/Non-Recurring],
        'XactlyTemplate'[Currency],
        'XactlyTemplate'[Sales Org],
        'XactlyTemplate'[Business Unit],
        'XactlyTemplate'[Partner Account],
        'XactlyTemplate'[Partner Name],
        'XactlyTemplate'[Sales Team],
        'XactlyTemplate'[Employee_ID_2],
        'XactlyTemplate'[Employee_2_Split_Percentage],
        'XactlyTemplate'[Employee_ID_3],
        'XactlyTemplate'[Employee_3_Split_Percentage],
        'XactlyTemplate'[Employee_ID_4],
        'XactlyTemplate'[Employee_4_Split_Percentage],
        'XactlyTemplate'[Employee_ID_5],
        'XactlyTemplate'[Employee_5_Split_Percentage],
        'XactlyTemplate'[Employee_ID_6],
        'XactlyTemplate'[Employee_6_Split_Percentage],
        'XactlyTemplate'[Employee_ID_7],
        'XactlyTemplate'[Employee_7_Split_Percentage],
        'XactlyTemplate'[Employee_ID_8],
        'XactlyTemplate'[Employee_8_Split_Percentage],
        'XactlyTemplate'[Employee_ID_9],
        'XactlyTemplate'[Employee_9_Split_Percentage],
        'XactlyTemplate'[Employee_ID_10],
        'XactlyTemplate'[Employee_10_Split_Percentage],
        'XactlyTemplate'[Employee_ID_1],
        TREATAS ( { DATE ( 2020, 9, 1 ) }, 'XactlyTemplate'[Performance Month] ),
        `"No_of_Units`", CALCULATE ( SUM ( 'XactlyTemplate'[# of Units] ) ),
        `"Total_Amt`", CALCULATE ( SUM ( 'XactlyTemplate'[Total Amt] ) ),
        `"Employee_1_Split_Percentage`", CALCULATE ( SUM ( 'XactlyTemplate'[Employee_1_Split_Percentage] ) )
    ),
    `"Performance_Month`", 'XactlyTemplate'[Performance Month],
    `"Invoice Number`", 'XactlyTemplate'[Invoice Number1],
    `"Transaction Date`", 'XactlyTemplate'[Transaction Date],
    `"Customer Unique ID`", 'XactlyTemplate'[Customer Unique ID],
    `"Customer Name`", 'XactlyTemplate'[Customer Name]
)"

$ExportPath = "REDACTED\DataExport.csv"
  
$Connection = New-Object -TypeName System.Data.OleDb.OleDbConnection
$Results = New-Object System.Data.DataTable
$Connection.ConnectionString = "Provider=MSOLAP.8;Data Source="+ $PowerBIEndpoint +";UID="+ $PowerBILogin +";PWD="+ $PowerBIPassword  
$Connection.Open() 
$Adapter = New-Object -TypeName System.Data.OleDb.OleDbDataAdapter $Query ,$Connection
$Adapter.Fill($Results) 
$Results | export-csv -Path $ExportPath -NoTypeInformation -Encoding UTF8noBOM
$Connection.Dispose()
$Connection.Close()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which outputs;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"[Performance_Month]","[Invoice Number]","[Transaction Date]","[Customer Unique ID]","[Customer Name]"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So still retaining the square brackets. The aim would be to replace them with nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for the switch, that's&amp;nbsp;because of the companies use of MFA but I intend to request a service account when I get this working, for now its a proof of concept so testing on my account with MFA is sufficient.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Oct 2020 18:12:06 GMT</pubDate>
    <dc:creator>mark_carlisle</dc:creator>
    <dc:date>2020-10-08T18:12:06Z</dc:date>
    <item>
      <title>Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1419160#M26029</link>
      <description>&lt;P&gt;I'm attempting to streamline an extremely convoluted process developed by one of my colleagues that involves exporting data from a Power BI report, renaming various columns, then uploading the final CSV to an S3 Bucket. Ideally I want to do this programmatically&amp;nbsp;so we can schedule it and forget about it. I'm able to export the data by using PowerShell, however, its not completely in the format I'd want. When I run the query the resulting CSV file contains [ ] around the column names. I've attempted to use SELECTCOLUMNS to rename the columns but this has the same result. Is there any way to achieve what I want in the DAX query?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current DAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EVALUATE
SUMMARIZECOLUMNS (
    'XactlyTemplate'[Performance Month],
    'XactlyTemplate'[Invoice Number1],
    'XactlyTemplate'[Transaction Date],
    'XactlyTemplate'[Customer Unique ID],
    'XactlyTemplate'[Customer Name],
    'XactlyTemplate'[Customer State],
    'XactlyTemplate'[Customer Region],
    'XactlyTemplate'[ContractID],
    'XactlyTemplate'[Contract Start Date],
    'XactlyTemplate'[Contract End Date],
    'XactlyTemplate'[Order/Contract Term in Months],
    'XactlyTemplate'[Order/Contract Term in Days],
    'XactlyTemplate'[Usage Type],
    'XactlyTemplate'[AcctAssignGroup],
    'XactlyTemplate'[Revenue Type],
    'XactlyTemplate'[Transaction Type Description],
    'XactlyTemplate'[Stock_Material Code],
    'XactlyTemplate'[Stock_Material Code Description],
    'XactlyTemplate'[Product Name],
    'XactlyTemplate'[Sub-Product],
    'XactlyTemplate'[Recurring/Non-Recurring],
    'XactlyTemplate'[Currency],
    'XactlyTemplate'[Sales Org],
    'XactlyTemplate'[Business Unit],
    'XactlyTemplate'[Partner Account],
    'XactlyTemplate'[Partner Name],
    'XactlyTemplate'[Sales Team],
    'XactlyTemplate'[Employee_ID_2],
    'XactlyTemplate'[Employee_2_Split_Percentage],
    'XactlyTemplate'[Employee_ID_3],
    'XactlyTemplate'[Employee_3_Split_Percentage],
    'XactlyTemplate'[Employee_ID_4],
    'XactlyTemplate'[Employee_4_Split_Percentage],
    'XactlyTemplate'[Employee_ID_5],
    'XactlyTemplate'[Employee_5_Split_Percentage],
    'XactlyTemplate'[Employee_ID_6],
    'XactlyTemplate'[Employee_6_Split_Percentage],
    'XactlyTemplate'[Employee_ID_7],
    'XactlyTemplate'[Employee_7_Split_Percentage],
    'XactlyTemplate'[Employee_ID_8],
    'XactlyTemplate'[Employee_8_Split_Percentage],
    'XactlyTemplate'[Employee_ID_9],
    'XactlyTemplate'[Employee_9_Split_Percentage],
    'XactlyTemplate'[Employee_ID_10],
    'XactlyTemplate'[Employee_10_Split_Percentage],
    'XactlyTemplate'[Employee_ID_1],
    TREATAS ( { DATE ( 2020, 9, 1 ) }, 'XactlyTemplate'[Performance Month] ),
    "No_of_Units", CALCULATE ( SUM ( 'XactlyTemplate'[# of Units] ) ),
    "Total_Amt", CALCULATE ( SUM ( 'XactlyTemplate'[Total Amt] ) ),
    "Employee_1_Split_Percentage", CALCULATE ( SUM ( 'XactlyTemplate'[Employee_1_Split_Percentage] ) )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: DAX to remove invalid SELECTCOLUMNS&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 05:17:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1419160#M26029</guid>
      <dc:creator>mark_carlisle</dc:creator>
      <dc:date>2020-10-08T05:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1419431#M26032</link>
      <description>&lt;P&gt;When I run such a query in DAX Studio I don't get any square brackets in the output format.&amp;nbsp; How are you piping the results of the query into your output file?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 00:31:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1419431#M26032</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-10-08T00:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1419991#M26034</link>
      <description>&lt;P&gt;Confirmed your test, the square brackets are not present in DAX Studio when running the same query. The full PowerShell script is below and is ran in PowerShell 7.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient") 

$PowerBIEndpoint = "REDACTED"
$PowerBILogin = ""
$PowerBIPassword = ""

$Query = 
"EVALUATE
    SUMMARIZECOLUMNS (
        'XactlyTemplate'[Performance Month],
        'XactlyTemplate'[Invoice Number1],
        'XactlyTemplate'[Transaction Date],
        'XactlyTemplate'[Customer Unique ID],
        'XactlyTemplate'[Customer Name],
        'XactlyTemplate'[Customer State],
        'XactlyTemplate'[Customer Region],
        'XactlyTemplate'[ContractID],
        'XactlyTemplate'[Contract Start Date],
        'XactlyTemplate'[Contract End Date],
        'XactlyTemplate'[Order/Contract Term in Months],
        'XactlyTemplate'[Order/Contract Term in Days],
        'XactlyTemplate'[Usage Type],
        'XactlyTemplate'[AcctAssignGroup],
        'XactlyTemplate'[Revenue Type],
        'XactlyTemplate'[Transaction Type Description],
        'XactlyTemplate'[Stock_Material Code],
        'XactlyTemplate'[Stock_Material Code Description],
        'XactlyTemplate'[Product Name],
        'XactlyTemplate'[Sub-Product],
        'XactlyTemplate'[Recurring/Non-Recurring],
        'XactlyTemplate'[Currency],
        'XactlyTemplate'[Sales Org],
        'XactlyTemplate'[Business Unit],
        'XactlyTemplate'[Partner Account],
        'XactlyTemplate'[Partner Name],
        'XactlyTemplate'[Sales Team],
        'XactlyTemplate'[Employee_ID_2],
        'XactlyTemplate'[Employee_2_Split_Percentage],
        'XactlyTemplate'[Employee_ID_3],
        'XactlyTemplate'[Employee_3_Split_Percentage],
        'XactlyTemplate'[Employee_ID_4],
        'XactlyTemplate'[Employee_4_Split_Percentage],
        'XactlyTemplate'[Employee_ID_5],
        'XactlyTemplate'[Employee_5_Split_Percentage],
        'XactlyTemplate'[Employee_ID_6],
        'XactlyTemplate'[Employee_6_Split_Percentage],
        'XactlyTemplate'[Employee_ID_7],
        'XactlyTemplate'[Employee_7_Split_Percentage],
        'XactlyTemplate'[Employee_ID_8],
        'XactlyTemplate'[Employee_8_Split_Percentage],
        'XactlyTemplate'[Employee_ID_9],
        'XactlyTemplate'[Employee_9_Split_Percentage],
        'XactlyTemplate'[Employee_ID_10],
        'XactlyTemplate'[Employee_10_Split_Percentage],
        'XactlyTemplate'[Employee_ID_1],
        TREATAS ( { DATE ( 2020, 9, 1 ) }, 'XactlyTemplate'[Performance Month] ),
        `"No_of_Units`", CALCULATE ( SUM ( 'XactlyTemplate'[# of Units] ) ),
        `"Total_Amt`", CALCULATE ( SUM ( 'XactlyTemplate'[Total Amt] ) ),
        `"Employee_1_Split_Percentage`", CALCULATE ( SUM ( 'XactlyTemplate'[Employee_1_Split_Percentage] ) )
)"

$ExportPath = "REDACTED\Export.csv"
  
$Connection = New-Object -TypeName System.Data.OleDb.OleDbConnection
$Results = New-Object System.Data.DataTable
$Connection.ConnectionString = "Provider=MSOLAP.8;Data Source="+ $PowerBIEndpoint +";UID="+ $PowerBILogin +";PWD="+ $PowerBIPassword  
$Connection.Open() 
$Adapter = New-Object -TypeName System.Data.OleDb.OleDbDataAdapter $Query ,$Connection
$Adapter.Fill($Results) 
$Results | export-csv -Path $ExportPath -NoTypeInformation -Encoding UTF8noBOM
$Connection.Dispose()
$Connection.Close()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SOURCE:&amp;nbsp;&lt;A href="https://sqlitybi.com/how-to-export-data-from-power-bi-using-xmla-endpoints/" target="_blank" rel="noopener"&gt;https://sqlitybi.com/how-to-export-data-from-power-bi-using-xmla-endpoints/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 05:25:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1419991#M26034</guid>
      <dc:creator>mark_carlisle</dc:creator>
      <dc:date>2020-10-08T05:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1421996#M26040</link>
      <description>&lt;P&gt;Hmm. The square brackets are kinda needed as they separate the column name from the table name.&amp;nbsp; You cannot guarantee that the query only returns values from a single host table.&amp;nbsp; What would you want to replace them with?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, what made you move from the ADOmd client to the OLEdb OLAP.8 client?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 17:54:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1421996#M26040</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-10-08T17:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1422029#M26041</link>
      <description>&lt;P&gt;Ah yes so, as my code is above the table name precedes&amp;nbsp;the column name in the square brackets. However, I've used SELECTCOLUMNS to get around this, so the script is now (first five columns as an example in the DAX query);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient") 

$PowerBIEndpoint = "REDACTED"
$PowerBILogin = ""
$PowerBIPassword = ""

$Query = 
"EVALUATE
SELECTCOLUMNS (
    SUMMARIZECOLUMNS (
        'XactlyTemplate'[Performance Month],
        'XactlyTemplate'[Invoice Number1],
        'XactlyTemplate'[Transaction Date],
        'XactlyTemplate'[Customer Unique ID],
        'XactlyTemplate'[Customer Name],
        'XactlyTemplate'[Customer State],
        'XactlyTemplate'[Customer Region],
        'XactlyTemplate'[ContractID],
        'XactlyTemplate'[Contract Start Date],
        'XactlyTemplate'[Contract End Date],
        'XactlyTemplate'[Order/Contract Term in Months],
        'XactlyTemplate'[Order/Contract Term in Days],
        'XactlyTemplate'[Usage Type],
        'XactlyTemplate'[AcctAssignGroup],
        'XactlyTemplate'[Revenue Type],
        'XactlyTemplate'[Transaction Type Description],
        'XactlyTemplate'[Stock_Material Code],
        'XactlyTemplate'[Stock_Material Code Description],
        'XactlyTemplate'[Product Name],
        'XactlyTemplate'[Sub-Product],
        'XactlyTemplate'[Recurring/Non-Recurring],
        'XactlyTemplate'[Currency],
        'XactlyTemplate'[Sales Org],
        'XactlyTemplate'[Business Unit],
        'XactlyTemplate'[Partner Account],
        'XactlyTemplate'[Partner Name],
        'XactlyTemplate'[Sales Team],
        'XactlyTemplate'[Employee_ID_2],
        'XactlyTemplate'[Employee_2_Split_Percentage],
        'XactlyTemplate'[Employee_ID_3],
        'XactlyTemplate'[Employee_3_Split_Percentage],
        'XactlyTemplate'[Employee_ID_4],
        'XactlyTemplate'[Employee_4_Split_Percentage],
        'XactlyTemplate'[Employee_ID_5],
        'XactlyTemplate'[Employee_5_Split_Percentage],
        'XactlyTemplate'[Employee_ID_6],
        'XactlyTemplate'[Employee_6_Split_Percentage],
        'XactlyTemplate'[Employee_ID_7],
        'XactlyTemplate'[Employee_7_Split_Percentage],
        'XactlyTemplate'[Employee_ID_8],
        'XactlyTemplate'[Employee_8_Split_Percentage],
        'XactlyTemplate'[Employee_ID_9],
        'XactlyTemplate'[Employee_9_Split_Percentage],
        'XactlyTemplate'[Employee_ID_10],
        'XactlyTemplate'[Employee_10_Split_Percentage],
        'XactlyTemplate'[Employee_ID_1],
        TREATAS ( { DATE ( 2020, 9, 1 ) }, 'XactlyTemplate'[Performance Month] ),
        `"No_of_Units`", CALCULATE ( SUM ( 'XactlyTemplate'[# of Units] ) ),
        `"Total_Amt`", CALCULATE ( SUM ( 'XactlyTemplate'[Total Amt] ) ),
        `"Employee_1_Split_Percentage`", CALCULATE ( SUM ( 'XactlyTemplate'[Employee_1_Split_Percentage] ) )
    ),
    `"Performance_Month`", 'XactlyTemplate'[Performance Month],
    `"Invoice Number`", 'XactlyTemplate'[Invoice Number1],
    `"Transaction Date`", 'XactlyTemplate'[Transaction Date],
    `"Customer Unique ID`", 'XactlyTemplate'[Customer Unique ID],
    `"Customer Name`", 'XactlyTemplate'[Customer Name]
)"

$ExportPath = "REDACTED\DataExport.csv"
  
$Connection = New-Object -TypeName System.Data.OleDb.OleDbConnection
$Results = New-Object System.Data.DataTable
$Connection.ConnectionString = "Provider=MSOLAP.8;Data Source="+ $PowerBIEndpoint +";UID="+ $PowerBILogin +";PWD="+ $PowerBIPassword  
$Connection.Open() 
$Adapter = New-Object -TypeName System.Data.OleDb.OleDbDataAdapter $Query ,$Connection
$Adapter.Fill($Results) 
$Results | export-csv -Path $ExportPath -NoTypeInformation -Encoding UTF8noBOM
$Connection.Dispose()
$Connection.Close()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which outputs;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"[Performance_Month]","[Invoice Number]","[Transaction Date]","[Customer Unique ID]","[Customer Name]"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So still retaining the square brackets. The aim would be to replace them with nothing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for the switch, that's&amp;nbsp;because of the companies use of MFA but I intend to request a service account when I get this working, for now its a proof of concept so testing on my account with MFA is sufficient.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 18:12:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1422029#M26041</guid>
      <dc:creator>mark_carlisle</dc:creator>
      <dc:date>2020-10-08T18:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1422223#M26043</link>
      <description>&lt;P&gt;How about this crude approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$Results&amp;nbsp;-replace '[\[\]]' | export-csv -Path $ExportPath -NoTypeInformation&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 20:15:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1422223#M26043</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-10-08T20:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1423657#M26047</link>
      <description>&lt;P&gt;Nice try unfortunately&amp;nbsp;I just get a single column called Length with the number 19 in it which is the number of characters in the first column. Tried a few other regex combinations to remove just one or specify nothing as its replacement, same result. Figured it was going to need something hacky in PS to achieve.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 08:22:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1423657#M26047</guid>
      <dc:creator>mark_carlisle</dc:creator>
      <dc:date>2020-10-09T08:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424311#M26049</link>
      <description>&lt;P&gt;Sounds like you omitted -NoTypeInformation ?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 12:25:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424311#M26049</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-10-09T12:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424564#M26050</link>
      <description>&lt;P&gt;No that was included code as it stands...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices.AdomdClient") 

$PowerBIEndpoint = "REDACTED"
$PowerBILogin = ""
$PowerBIPassword = ""

$Query = 
"EVALUATE
SELECTCOLUMNS (
    SUMMARIZECOLUMNS (
        'XactlyTemplate'[Performance Month],
        'XactlyTemplate'[Invoice Number1],
        'XactlyTemplate'[Transaction Date],
        'XactlyTemplate'[Customer Unique ID],
        'XactlyTemplate'[Customer Name],
        'XactlyTemplate'[Customer State],
        'XactlyTemplate'[Customer Region],
        'XactlyTemplate'[ContractID],
        'XactlyTemplate'[Contract Start Date],
        'XactlyTemplate'[Contract End Date],
        'XactlyTemplate'[Order/Contract Term in Months],
        'XactlyTemplate'[Order/Contract Term in Days],
        'XactlyTemplate'[Usage Type],
        'XactlyTemplate'[AcctAssignGroup],
        'XactlyTemplate'[Revenue Type],
        'XactlyTemplate'[Transaction Type Description],
        'XactlyTemplate'[Stock_Material Code],
        'XactlyTemplate'[Stock_Material Code Description],
        'XactlyTemplate'[Product Name],
        'XactlyTemplate'[Sub-Product],
        'XactlyTemplate'[Recurring/Non-Recurring],
        'XactlyTemplate'[Currency],
        'XactlyTemplate'[Sales Org],
        'XactlyTemplate'[Business Unit],
        'XactlyTemplate'[Partner Account],
        'XactlyTemplate'[Partner Name],
        'XactlyTemplate'[Sales Team],
        'XactlyTemplate'[Employee_ID_2],
        'XactlyTemplate'[Employee_2_Split_Percentage],
        'XactlyTemplate'[Employee_ID_3],
        'XactlyTemplate'[Employee_3_Split_Percentage],
        'XactlyTemplate'[Employee_ID_4],
        'XactlyTemplate'[Employee_4_Split_Percentage],
        'XactlyTemplate'[Employee_ID_5],
        'XactlyTemplate'[Employee_5_Split_Percentage],
        'XactlyTemplate'[Employee_ID_6],
        'XactlyTemplate'[Employee_6_Split_Percentage],
        'XactlyTemplate'[Employee_ID_7],
        'XactlyTemplate'[Employee_7_Split_Percentage],
        'XactlyTemplate'[Employee_ID_8],
        'XactlyTemplate'[Employee_8_Split_Percentage],
        'XactlyTemplate'[Employee_ID_9],
        'XactlyTemplate'[Employee_9_Split_Percentage],
        'XactlyTemplate'[Employee_ID_10],
        'XactlyTemplate'[Employee_10_Split_Percentage],
        'XactlyTemplate'[Employee_ID_1],
        TREATAS ( { DATE ( 2020, 9, 1 ) }, 'XactlyTemplate'[Performance Month] ),
        `"No_of_Units`", CALCULATE ( SUM ( 'XactlyTemplate'[# of Units] ) ),
        `"Total_Amt`", CALCULATE ( SUM ( 'XactlyTemplate'[Total Amt] ) ),
        `"Employee_1_Split_Percentage`", CALCULATE ( SUM ( 'XactlyTemplate'[Employee_1_Split_Percentage] ) )
    ),
    `"Performance Month`", 'XactlyTemplate'[Performance Month],
    `"Invoice Number1`", 'XactlyTemplate'[Invoice Number1],
    `"Transaction Date`", 'XactlyTemplate'[Transaction Date],
    `"Customer Unique ID`", 'XactlyTemplate'[Customer Unique ID],
    `"Customer Name`", 'XactlyTemplate'[Customer Name],
    `"Customer State`", 'XactlyTemplate'[Customer State],
    `"Customer Region`", 'XactlyTemplate'[Customer Region],
    `"ContractID`", 'XactlyTemplate'[ContractID],
    `"Contract Start Date`", 'XactlyTemplate'[Contract Start Date],
    `"Contract End Date`", 'XactlyTemplate'[Contract End Date],
    `"Order/Contract Term in Months`", 'XactlyTemplate'[Order/Contract Term in Months],
    `"Order/Contract Term in Days`", 'XactlyTemplate'[Order/Contract Term in Days],
    `"Usage Type`", 'XactlyTemplate'[Usage Type],
    `"AcctAssignGroup`", 'XactlyTemplate'[AcctAssignGroup],
    `"Revenue Type`", 'XactlyTemplate'[Revenue Type],
    `"Transaction Type Description`", 'XactlyTemplate'[Transaction Type Description],
    `"Stock_Material Code`", 'XactlyTemplate'[Stock_Material Code],
    `"Stock_Material Code Description`", 'XactlyTemplate'[Stock_Material Code Description],
    `"Product Name`", 'XactlyTemplate'[Product Name],
    `"Sub-Product`", 'XactlyTemplate'[Sub-Product],
    `"Recurring/Non-Recurring`", 'XactlyTemplate'[Recurring/Non-Recurring],
    `"Currency`", 'XactlyTemplate'[Currency],
    `"Sales Org`", 'XactlyTemplate'[Sales Org],
    `"Business Unit`", 'XactlyTemplate'[Business Unit],
    `"Partner Account`", 'XactlyTemplate'[Partner Account],
    `"Partner Name`", 'XactlyTemplate'[Partner Name],
    `"Sales Team`", 'XactlyTemplate'[Sales Team],
    `"Employee_ID_2`", 'XactlyTemplate'[Employee_ID_2],
    `"Employee_2_Split_Percentage`", 'XactlyTemplate'[Employee_2_Split_Percentage],
    `"Employee_ID_3`", 'XactlyTemplate'[Employee_ID_3],
    `"Employee_3_Split_Percentage`", 'XactlyTemplate'[Employee_3_Split_Percentage],
    `"Employee_ID_4`", 'XactlyTemplate'[Employee_ID_4],
    `"Employee_4_Split_Percentage`", 'XactlyTemplate'[Employee_4_Split_Percentage],
    `"Employee_ID_5`", 'XactlyTemplate'[Employee_ID_5],
    `"Employee_5_Split_Percentage`", 'XactlyTemplate'[Employee_5_Split_Percentage],
    `"Employee_ID_6`", 'XactlyTemplate'[Employee_ID_6],
    `"Employee_6_Split_Percentage`", 'XactlyTemplate'[Employee_6_Split_Percentage],
    `"Employee_ID_7`", 'XactlyTemplate'[Employee_ID_7],
    `"Employee_7_Split_Percentage`", 'XactlyTemplate'[Employee_7_Split_Percentage],
    `"Employee_ID_8`", 'XactlyTemplate'[Employee_ID_8],
    `"Employee_8_Split_Percentage`", 'XactlyTemplate'[Employee_8_Split_Percentage],
    `"Employee_ID_9`", 'XactlyTemplate'[Employee_ID_9],
    `"Employee_9_Split_Percentage`", 'XactlyTemplate'[Employee_9_Split_Percentage],
    `"Employee_ID_10`", 'XactlyTemplate'[Employee_ID_10],
    `"Employee_10_Split_Percentage`", 'XactlyTemplate'[Employee_10_Split_Percentage],
    `"Employee_ID_1`", 'XactlyTemplate'[Employee_ID_1]
)"

$ExportPath = "REDACTED\DataExport.csv"

$Connection = New-Object -TypeName System.Data.OleDb.OleDbConnection
$Results = New-Object System.Data.DataTable
$Connection.ConnectionString = "Provider=MSOLAP.8;Data Source="+ $PowerBIEndpoint +";UID="+ $PowerBILogin +";PWD="+ $PowerBIPassword  
$Connection.Open() 
$Adapter = New-Object -TypeName System.Data.OleDb.OleDbDataAdapter $Query ,$Connection
$Adapter.Fill($Results) 
$Results -replace '[\[\]]' | export-csv -Path $ExportPath -NoTypeInformation #-Encoding UTF8noBOM -
$Connection.Dispose()
$Connection.Close()&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Oct 2020 14:24:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424564#M26050</guid>
      <dc:creator>mark_carlisle</dc:creator>
      <dc:date>2020-10-09T14:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424579#M26051</link>
      <description>&lt;P&gt;You're right. I see it too. How about this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$Results | export-csv -Path $ExportPath -NoTypeInformation&amp;nbsp;&lt;BR /&gt;(Get-Content -Path $ExportPath ) -replace '[\[\]]' | Set-Content -Path $ExportPath&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 14:33:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424579#M26051</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-10-09T14:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424603#M26052</link>
      <description>&lt;P&gt;That's the one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 14:44:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424603#M26052</guid>
      <dc:creator>mark_carlisle</dc:creator>
      <dc:date>2020-10-09T14:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424608#M26053</link>
      <description>&lt;P&gt;Please do let me know once you get the ADOmd to work. So far it errors out for me.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2020 14:47:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/1424608#M26053</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-10-09T14:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Removing square brackets from column headers DAX query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/2101417#M32090</link>
      <description>&lt;P&gt;Here's a cleaner way, directly modifying the column names in the dataset, only having to write the file once.&amp;nbsp; The Split method treats the brackets as delimiters and selects the second element of the resulting array as the column name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$Adapter.Fill($Results)&lt;BR /&gt;$Results.Columns.ColumnName | &lt;BR /&gt;   ForEach-Object { &lt;BR /&gt;      $Results.Columns[$_].ColumnName = $_.Split(@('[',']'))[1] &lt;BR /&gt;   }&lt;BR /&gt;$Results | Export-CSV -Path &lt;SPAN&gt;$ExportPath&lt;/SPAN&gt; -NoTypeInformation&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Sep 2021 23:06:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Removing-square-brackets-from-column-headers-DAX-query/m-p/2101417#M32090</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-27T23:06:19Z</dc:date>
    </item>
  </channel>
</rss>

