Your PBIP Has Tables and No Measures. Claude’s Free Plan Can Write 65 of Them.
From the publisher’s feed, collected in the ZeroLabs newsroom.
The prompts, the order I work in, the errors that stop a TMDL file from opening, and the checks that catch wrong numbers.You have a Power BI project with the tables loaded and the relationships drawn. The Fields pane is full of raw columns and there is not one measure. Total Sales, Sales PY, Sales YTD and Gross Margin % all still have to be written.Most measures in a model like this are variations on a few patterns: a base measure, its prior-year version, a growth percentage. The prompt further down asks for 65 measures, and 21 of them are time intelligence.A PBIP saves the semantic model as plain-text TMDL files. So you can give those files to Claude, list the measures you want, and get back a finished _Measures.tmdl to drop into the project folder. This guide uses Claude's free plan. I wrote it for my workshop participants, with a retail case study called PT Nusa Retail as the model.The project starts with tables and relationships and no measures:NusaRetail.SemanticModel/ definition/ model.tmdl relationships.tmdl tables/ Sales.tmdl _Measures.tmdl Dim_Date.tmdlThe PBIP folder before Claude writes anythingThe whole workflow in one sentence: give the TMDL files to Claude as context, let it write or tidy the TMDL, paste the result back into the PBIP folder, then open the project and refresh.Step 0: Set up onceIn Power BI Desktop, open File > Options > Preview features and turn on “Power BI Project (.pbip) save option” and “Store semantic model using TMDL format”.Turn off Auto date/time in Options > Current File > Data Load. With it on, Desktop adds hidden LocalDateTable_* tables, and their leftovers cause one of the errors in Step 5.Save the file as .pbip with File > Save As.Close Power BI Desktop. Don’t edit TMDL files while the project is open in it.The two preview features that make the PBIP and TMDL folder structure possibleAuto date/time off, so no hidden date tables get createdStep 1: Give Claude the modelPut all the files in a single message to save your message limit. Send model.tmdl (the table list and model settings), relationships.tmdl, the fact table Sales.tmdl, the calendar Dim_Date.tmdl, and every other dimension table such as Products, Customers and Stores.If Claude refuses the .tmdl upload, rename the files to .txt or paste their contents. You can cut the long partition blocks, which hold the Power Query source. Claude only needs table names, column names and data types to write correct DAX.If you will work on the same model across several chats, store the TMDL files in a Claude Project’s knowledge so you don’t upload them every time.Step 2: Ask for the measuresThe prompt below lists every measure by display folder and sets the writing rules. It is an English version of the prompt I give participants in Indonesian.I have a Power BI Project (PBIP) in TMDL format. I uploaded my model files(model.tmdl, relationships.tmdl, and every table file).Read the table, column, and relationship structure before you write any DAX.Create a new file, tables/_Measures.tmdl, with the measures below,grouped by displayFolder:01. Sales Total Sales, Gross Sales, Discount Amount, Discount %, Total Qty, Total Orders, Avg Order Value, Avg Selling Price, Avg Qty per Order02. Profitability Total COGS (Qty x Products[UnitCost]), Gross Profit, Gross Margin %03. Time Intelligence (use Dim_Date[Date]) Sales PY, Sales YoY, Sales YoY %, Sales PM, Sales MoM %, Sales MTD, Sales QTD, Sales YTD, Sales YTD PY, Sales YTD YoY %, Sales Rolling 3M, Gross Profit PY, Gross Profit YoY %, Gross Margin % PY, Gross Margin Δ pts, Orders PY, Orders YoY %, Customers PY, Customers YoY %, AOV PY, AOV YoY %04. Target Sales Target (use TREATAS from Stores[Region] to Targets_2025_wide[Region]), Sales vs Target, Target Achievement %, Sales Target YTD, Target Achievement YTD %05. Customer Active Customers, New Customers, Returning Customers, Repeat Customer Rate %, Sales per Customer, Orders per Customer06. Contribution & Ranking Sales % of Total, Product Rank, Store Rank, Cumulative Sales % (Pareto)07. UI & Formatting Last Sales Date, Report Period Label, Sales YoY Label, Color YoY, Color Achievement08. KPI Card (each KPI gets one Label and one Color) KPI AOV Label/Color, KPI Customers Label/Color, KPI Gross Profit Label/Color, KPI Margin Label/Color, KPI Sales YTD Label/Color, KPI Target Label/Color - Label: short text for the card, for example "Rp 1.2 M" or "▲ 12.3% vs PY" (Rb = thousand, Jt = million, M = billion) - Color: hex code for conditional formatting (green = good, red = bad, gray = no comparison data)Writing rules:1. All measures in one file, in folder order 01 to 08.2. Write displayFolder exactly as named above (for example: 01. Sales).3. formatString: Rupiah \R\p #,0 ; percent 0.0% ; counts #,0 ; text and color measures need no formatString.4. Write each description with /// above the measure line (NOT a description: property), in Indonesian.5. _Measures is a calculated table: ROW("Value", BLANK()) with the Value column hidden. Do not write dataType on that column, same as the other calculated columns in my model.6. Use DIVIDE for every division. Use table names exactly as the model spells them (Dim_Date, not dim_date).7. File format: tab indentation, CRLF line endings, a new lineageTag for every measure.8. Ranking and Pareto measures only fill in when the related column is in the visual (ISINSCOPE/HASONEVALUE).When the file is done, also give me:- the line to add to model.tmdl (ref table _Measures)- the folder structure and measure names as plain text- a note on any risk in my model (for example a bidirectional relationship, or a product with no UnitCost) that could make the numbers wrongOutput: the complete file, ready to copy.Change “in Indonesian” in rule 4 to your team’s language.One message with every model file and the full measure listThree lines in that prompt need a note.Rule 4 asks for descriptions with /// above each measure instead of a description: property. TMDL reads /// as the description of the line directly below it, so no blank line can sit between them. Step 5 shows what happens when one does.Total COGS multiplies quantity by Products[UnitCost]. A product with no UnitCost gets zero cost, so its margin looks better than it is. That is why the last paragraph asks Claude to list risks like this one, along with bidirectional relationships.In the KPI Card labels, Rb, Jt and M are the Indonesian abbreviations for thousand, million and billion. “Rp 1.2 M” means 1.2 billion rupiah.To add measures to a file you already have, use this follow-up:Add the following measures to the existing _Measures.tmdl:- 04. Target: Sales Target, Target Achievement %, Sales vs Target- 05. Customer: Active Customers, New Customers, Returning Customers- 06. Ranking: Product Rank, Sales % of Total, Cumulative Sales % (Pareto)Give me the complete _Measures.tmdl file, not a fragment.Ask for the complete file every time. A fragment is easy to paste into the wrong place.The first measures in Claude’s outputStep 3: Tidy the modelDo the measures first, review them, and only then tidy the model. This prompt hides the ID columns, fixes sorting and checks the relationships:Review my TMDL model and tidy it up:1. Hide the foreign key (ID) columns and the raw numeric columns in the fact table2. Make sure Dim_Date has dataCategory: Time and the Date column isKey3. Set sortByColumn (Month Name sorted by Month No)4. Change summarizeBy to none for columns that should not be summed5. Check the relationships: are any many-to-many, inactive, or unused?Do not change the partition/source Power Query and do not changeany lineageTag.Give me only the files that changed, complete from the first lineto the last.Claude must not touch lineageTag. That ID links tables, columns and measures to the visuals already built on them, so rewriting it can break those visuals.If you have no calendar table yet, ask for one:Create tables/Dim_Date.tmdl as a calculated table using CALENDAR from theminimum to the maximum Sales[OrderDate] (start of year to end of year).Columns: Date, Year, Quarter, Month No, Month Name, Month Short, Year Month,Year Month Key, Week No, Day Name, Day Type (Weekday/Weekend).Set dataCategory: Time, Date as isKey, and the correct sortByColumn.Also give me a new relationship Sales[OrderDate] -> Dim_Date[Date]to add to relationships.tmdl.Check how Claude builds Month No. It should come from MONTH(Dim_Date[Date]), not from Month Name. Month Name is sorted by Month No, and a sort column that depends on the column it sorts produces a circular dependency error.Step 4: Put the files backCopy Claude’s files into definition/ and definition/tables/.Add ref table _Measures to model.tmdl, and ref table Dim_Date if the calendar is new.Delete .pbi/cache.abf if you changed a column's data type or removed a table.Open the .pbip and click Refresh.All 65 measures, grouped by display folder.Step 5: When the project won’t openCopy only the Error Message from the dialog, not the whole stack trace, and send it back with this:I got this error when opening the PBIP:[paste Error Message]Which file is wrong and how do I fix it?Give me the corrected file, complete.These are the errors I meet most often, with the cause and the fix.description is not a supported propertyA table description was written as description:. Put /// text on the line above table instead.variation Variation ... refers to an object which cannot be foundA leftover from Auto date/time. Delete the variation block on the date column, and delete the LocalDateTable_*.tmdl and DateTableTemplate_*.tmdl files.Type mismatch. Datatype conversion failedYou changed a column’s type but the cache still holds the old data. Delete .pbi/cache.abf, then refresh.Cannot find table/column inside a measureA table or column name in the DAX doesn’t match the model. Send the table files to Claude again and ask it to match the names.Four more came up when I built other PBIPs this way.Unexpected line type: Empty!A blank line sits between a /// description and the object under it. I got this when Claude used /// blocks as section headers. Put /// directly above the measure it describes.The 'Goals' measure cannot be created because a column with the same name already exists.A measure and a column in the same table share a name. Rename the column (GoalsRaw, for example) and leave its sourceColumn as it is, so the data mapping doesn't change.Property QueryGroup of object "expression DataFolderPath" refers to an object which cannot be foundA queryGroup: line points at a query group that was never declared on the model. Delete the line. It only controls folders in the Power Query pane.A circular dependency was detected: DimPlayer[Position], DimPlayer[PositionSort], DimPlayer[Position]A column is sorted by a calculated column that reads the first column. Build the sort key from a column that doesn’t depend on it, such as Month No from MONTH(Dim_Date[Date]).Step 6: Check the numbersClaude speeds up the writing. It doesn’t check results against your data, so you do:Every measure shows in the _Measures table, grouped by folder.Total Sales equals the SUM of the Sales Amount column in Data view.The PY and YoY measures return values when you use columns from Dim_Date.Month Name sorts Jan to Dec, not alphabetically.ID columns no longer appear in the Fields pane.Rupiah and percent formats display correctly.Total Sales against the raw sumStart with Total Sales. Sales PY, Sales YTD and the target measures are normally built on it, so a wrong total repeats through all of them.I build Power BI models and data pipelines for mid-market companies.Tags: power-bi claude-ai tmdl dax data-modelingYour PBIP Has Tables and No Measures. Claude’s Free Plan Can Write 65 of Them. was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.