web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Change column order an...
Power Automate
Suggested Answer

Change column order and name when emailing out CSV file from dataset

(0) ShareShare
ReportReport
Posted on by 10
Hello All,
 
Power Automate newbie here so really appreciate your suggestions on this issue i'm having. 
 
I created a simple flow to email a table of data from Power BI.  Since the row count exceeds 1k I had to go through the PA online to make it work.  The flow has the following steps:
 
1. Query against Power BI Dataset
2. Create CSV Table
3. Email that CSV 
 
The issue I am having is - I went into Power BI and did the step where you record the table dax query in the analyzer to get that however the order it created it in is not the order that is in the table visual.  Second is that the column headers are giving a DB like appearance like Table[Column] instead of Name for example.  
 
My question is - what is the best way to change the order and names of the columns from the dataset query?  I tried to go into the DAX code in step 1 and change it there but that keeps giving me errors that don't make any sense like a column has more than 1 value, etc. after I change the code but if I run it as-is it works just fine.  
 
Any suggestions would be appreciated - thanks!
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    68,717 Most Valuable Professional on at
    Using a Data Select action in the flow to process the array produced by the query you can specify which columns you want, the order you want them in, and supply each column with a new name. Then use the output of the Data Select to create the CSV file.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • CU05121516-0 Profile Picture
    10 on at
    Thanks for the suggestion - I tried this but there is no way to link the Select to the dataset that I pull - at least from what I can tell.  Do I need to use some code or something?  When I hit Dynamic it just shows first few rows and if select that it just puts that in but not a column designation, etc.  So, I tried to put in a Parse JSON before the select so it had something to grab onto which it worked from that aspect but when I went to Run it - it errors out saying my Schema on the Parse JSON is invalid.  I put it in there by going to the output of the Query against the PBI Dataset step - since I had 1200 or so rows in there the code was quite long like 35k or something like that - is that why it said Invalid?  
     
    Any suggestions on how to use the Select or get my Schema to be 'valid'?  
  • CU05121516-0 Profile Picture
    10 on at
    The other odd thing is that the Parse JSON only tells me it has an error in the steps for Invalid Schema - when I click into it to see where specifically it doesn't say anything about an error.  There are no outputs, etc.  So its hard to say where its failing.  I read something about you need to specifically copy/paste it in a way otherwise it throws back errors - does that make any sense?  Or any thoughts on why my job keeps failing?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard