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 :-)