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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Export CSV file of dat...
Power Automate
Suggested Answer

Export CSV file of data from Power BI report using Slicer

(3) ShareShare
ReportReport
Posted on by 10
Hello,
 
I have built a Power BI report and want to use the Power Automate button to automatically export the table visual data to a CSV.
 
I have almost done this, by using the following code within the "Run a query against a dataset" step:
DEFINE
VAR _table = 
CALCULATETABLE(
    SELECTCOLUMNS(
        'CSV_Credits'
        , "Identifier", 'CSV_Credits'[Identifier]
        , "Transaction Type", 'CSV_Credits'[Transaction Type]
        , "Supplier Account", 'CSV_Credits'[Supplier Account]
        , "Supplier Reference", 'CSV_Credits'[Supplier Reference]
        , "Invoice Date", FORMAT('CSV_Credits'[Invoice Date], "dd/mm/yyyy")
        , "Total Goods Value", 'CSV_Credits'[Total Goods Value]
        , "Total VAT Value", 'CSV_Credits'[Total VAT Value]
        , "Total Invoice Value", 'CSV_Credits'[Total Invoice Value]
        , "Cost Centre", 'CSV_Credits'[Cost Centre]
        , "Expense Code", 'CSV_Credits'[Expense Code]
        , "Item Value Exc VAT", 'CSV_Credits'[Item Value Exc VAT]
        , "Item VAT Code", 'CSV_Credits'[Item VAT Code]
        , "Item Narrative", 'CSV_Credits'[Item Narrative]
        , "SortOrder", 'CSV_Credits'[SortOrder]
             ),'CSV_Credits'[Invoice Date] = EOMONTH(TODAY(),-1) 

EVALUATE _table
ORDER BY [SortOrder] ASC
 
a) I need to change the parameter of 'CSV_Credits'[Invoice Date] = EOMONTH(TODAY(),-1) so that it uses the Slicer data (Invoice Date) that the user has set on the PBI page prior to hitting the "Run Flow" button.
What is the syntax I need to use please? 
 
b) Also, how can I name the file within the "SharePoint Create File" stage so that it uses the selected date from the Slicer?
I currently have "addToTime(utcNow(),-1,'Month','yyyy-MM')"in the file name but need it to be the date selected by the user from the Invoice Date Slicer, if this is possible?
 
 
Many thanks in advance :-)
Categories:
I have the same question (0)
  • Suggested answer
    Jon Unzueta Profile Picture
    1,834 Super User 2026 Season 1 on at
     
     

    You're very close! Let’s address both parts of your question to help you dynamically filter and name your export using slicer values in Power BI and Power Automate.


     a) Use Slicer Value in DAX Query

    To use the slicer value (e.g., Invoice Date) selected by the user in Power BI, you need to pass it as a parameter to Power Automate via the Power Automate visual.

    Steps:

    1. In Power BI, add the Power Automate visual to your report.
    2. Drag the Invoice Date field (from the slicer) into the Power Automate visual’s data pane.
    3. In Power Automate, use the “Power BI data” trigger and reference the passed value.

    Modify your DAX query:

    Replace:

    'CSV_Credits'[Invoice Date] = EOMONTH(TODAY(),-1)

    With

    'CSV_Credits'[Invoice Date] = DATEVALUE(@InvoiceDate)

     

    Where @InvoiceDate is the parameter passed from Power BI.

    ⚠️ Make sure the date format matches what Power BI sends (usually ISO format like yyyy-mm-dd).


     b) Use Slicer Value in File Name

    To name the file using the selected Invoice Date:

    1. In Power Automate, use the “Power BI data” trigger to capture the slicer value.
    2. Use a Compose action to format the date:
       

    formatDateTime(triggerOutputs()?['body/InvoiceDate'], 'yyyy-MM')

    Use this output in the “Create file” action’s file name

    CSV_Credits_@{outputs('Compose')}.csv

    Bonus Tip

    If your slicer allows multiple dates, consider using:

    • MIN(InvoiceDate) or MAX(InvoiceDate) in Power BI
    • Or aggregate the values before passing them to Power Automate

     

    🏷️ Tag me if you have any further questions or if the issue persists.
    ✅ Click "Accept as Solution" if my post helped resolve your issue—it helps others facing similar problems.
    ❤️ Give it a Like if you found the approach useful in any way.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard