Back in December the FabricAI.Prompt() M function was released in Fabric Dataflows Gen2. Most of the people writing about it at that time, as in this great post by my colleague Sandeep Pawar, focused on calling this function for each row in a table – something that the UI in the editor makes easy. However the FabricAI.Prompt() function itself is a lot more flexible. You can use it to summarise whole tables of data as I showed here; you can also use it to generate sample data. This is similar to what I blogged about here where I got Copilot to generate M code that returned sample data but using FabricAI.Prompt() is maybe a bit simpler.
The trick is to get FabricAI.Prompt() to generate a table of data in CSV format. Here’s an example prompt:
Generate a table of sample sales data in CSV format. The table should have three columns called Country, Product and Sales. The Country column should contain the names of random European countries. The Product column should contain the names of random types of fruit. The Sales column should contain random numbers between 1 and 100. The table should contain 10 rows. The first row of text returned should contain the column names. Subsequent rows should contain the data.
…and here’s how this prompt can be used with Fabric.AIPrompt() and how the text that the function returns can be turned into a table using the CSV.Document function:
let Source = FabricAI.Prompt( "Generate a table of sample sales data in CSV format. The table should have three columns called Country, Product and Sales. The Country column should contain the names of random European countries. The Product column should contain the names of random types of fruit. The Sales column should contain random numbers between 1 and 100. The table should contain 10 rows. The first row of text returned should contain the column names. Subsequent rows should contain the data." ), ToCSV = Csv.Document(Source), #"Promoted headers" = Table.PromoteHeaders( ToCSV, [PromoteAllScalars = true] ), #"Changed column type" = Table.TransformColumnTypes( #"Promoted headers", { {"Country", type text}, {"Product", type text}, {"Sales", Int64.Type} } )in #"Changed column type"
And here’s an example of the result:

Hi, very interesting. I tried it changing the prompt with “The table should contain 1000 rows” but the output generated is containing just 10 rows and in the 11 i got “(rows 11 to 1000 follow the same pattern with varied data)”, I tried adding to the prompt a command like ” Include in the output all the rows with all the fields generated” but it not working, is there any limitation?
Interesting – I have had timeouts when asking for larger amounts of data but not this, but I guess it’s something that you would expect with LLMs. Try adding something like “There should be nothing other than data in CSV format in the response because the response will be consumed by code that expects to receive a CSV file” to the prompt