
Reports > Sales overview > Export
Open in TWICE Admin
Prerequisites
- Power BI Desktop, and a Power BI service workspace if you want scheduled refresh.
- The ledger endpoints and file format from Pull your data into a BI tool. This guide uses them without repeating them.
- Your currency code and the first date you want history from.
The walkthrough
Store the key in a parameter
TwiceApiKey, set Type to Text, and paste the key into Current Value.Add the revenue ledger query
currency and FromDate to yours. Rename the query Revenue.The fixed base URL with RelativePath and Query is what lets the Power BI service refresh the query. A URL assembled as one string refreshes in Desktop and fails in the service.Connect anonymously
Add the payments ledger query
Revenue query, rename the copy Payments, and change RelativePath to internal/reporting/payments/export. Replace the typed columns with Payment_Date as type date and Amount_Total as type number.Relate the two tables
Payments[Revenue_Row_ID] onto Revenue[Row_ID] to create a many-to-one relationship.Publish and set the credentials in the service
Schedule the refresh
"en-US" culture reads 202.42 as a number on a computer set to a comma-decimal locale, such as Finnish. The tax columns are left untyped, because their number follows the tax rates in the period.
Load more than 100,000 rows
Split the history into one call per year and append the results. Keep it to five years or fewer per refresh, the export rate limit described in Pull your data into a BI tool.Typed step from the first query to the end of this one.
How do I know it worked?
- The
Revenuetable shows one row per order line, andAmount_Totalis a number column. - A card summing
Amount_Totalfiltered toStarted_In_Period = "Yes"matches the Revenue report in the admin for the same period and currency. - The semantic model’s Refresh history in the service shows a completed scheduled refresh.
Troubleshooting / common pitfalls
The service says the dataset includes a dynamic data source
The service says the dataset includes a dynamic data source
RelativePath and Query options, as in the query above, and publish again.Amounts load as text, or as 20242 instead of 202.42
Amounts load as text, or as 20242 instead of 202.42
"en-US" culture argument in Table.TransformColumnTypes, and delete any Changed Type step Power Query added on its own.Refresh fails with "The column 'Tax_Rate_2' of the table wasn't found"
Refresh fails with "The column 'Tax_Rate_2' of the table wasn't found"
Refresh fails with 429 Too Many Requests
Refresh fails with 429 Too Many Requests
Revenue and Payments models apart.Refresh fails with 401 after it worked before
Refresh fails with 401 after it worked before
TwiceApiKey parameter, in Desktop or under the semantic model’s Parameters in the service.