Forum Discussion

Sco453's avatar
Sco453
New Member
1 year ago
Solved

CSV exported Text Column changes to date Format?? (PowerBi-PowerAutomate-CSV)

Hi So I've created a button in Powerbi to export the sliced data & email it to user. It works great. Except 1 column which has numbers (eg. 32-47) shows up as a date format in the csv, the column wi...
  • saud968's avatar
    1 year ago

    There are a few strategies you can try to ensure your data remains in the correct format:

    Prepend a Single Quote: In Power BI, you can prepend a single quote (') to your text values. This tells Excel to treat the value as text. For example, you can create a calculated column in Power BI with the following DAX formula:

    NewColumn = "'" & [YourColumn]
    Use Power Query to Format Data: Before exporting, you can use Power Query to ensure the column is explicitly set as text. In Power Query Editor, select the column, go to the "Transform" tab, and choose "Data Type" > "Text".

    Custom Formatting in Excel: If you have control over the Excel file, you can apply a custom format to the column after exporting. Select the column, right-click, choose "Format Cells", and set the format to "Text".

    Power Automate Flow: If you're using Power Automate to handle the export, you can add a step to format the column as text before creating the CSV file.

    CSV Formatting: Ensure your CSV export includes double quotes around the text values. This can sometimes prevent Excel from auto-formatting the data. For example:

    "500","34 - 37","Aug-22","40 - 55","1.7"
    These steps should help maintain the integrity of your data when exporting from Power BI to CSV and then opening in Excel.

    Best Regards
    Saud Ansari
    If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!