semantic-model
Skill9 starsChanged 10 months agoMITView on GitHub
Creates and modifies Power BI semantic models using TMDL format. Use for tables, columns, relationships, and model configuration.
In this repository9 other files it gives its agents.
- best-practicesSkill
- calculation-groupsSkill
- daxSkill
- deploymentSkill
- pbip-projectSkill
- power-querySkill
- report-visualsSkill
- securitySkill
- themesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 12 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 313
Every object needs a unique lineageTag (GUID).
- Distinctive: line 324
Always use TMDL format (not JSON/BIM)
- Very specific: line 325
Always include lineageTag for every object
- Very specific: line 326
Use isHidden for key columns in dimension tables
- Very specific: line 328
Use summarizeBy: sum (or appropriate) for measure columns
- Very specific: line 330
Add descriptions using /// comments above measures
- Distinctive: line 331
Use single quotes for identifiers with spaces
- Very specific: line 334
Never use implicit measures (set discourageImplicitMeasures: true)
- Distinctive: line 335
Never create bi-directional relationships unless required
- Distinctive: line 336
Never expose key columns to end users
- Distinctive: line 337
Never duplicate data across tables
- Distinctive: line 338
Never use calculated columns when measures will work
- Very specific: line 344
Add measures: - Use the dax skill to create business measures
- Very specific: line 345
Validate: - Use the best-practices skill to check the model
- Distinctive: line 353
Verify column names match exactly (case-sensitive)
- Distinctive: line 354
Ensure data types are compatible
- Distinctive: line 355
Check that the "to" column is the key column
- Distinctive: line 358
Verify M expression syntax
- Distinctive: line 359
Check that data source expressions exist
- Distinctive: line 360
Ensure credentials are configured in Power BI Desktop
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Semantic Model Skill
This skill helps create and modify Power BI semantic models using TMDL (Tabular Model Definition Language) format.
When to Use This Skill
- Creating new tables with columns
- Defining relationships between tables
- Adding hierarchies to tables
- Configuring data sources and partitions
- Setting model properties (culture, compatibility level)
- Applying Tabular Editor patterns
TMDL Syntax Overview
TMDL uses indentation-based syntax (tabs, not spaces) with these key constructs:
Tables
table Sales
lineageTag: a1b2c3d4-e5f6-7890-abcd-ef1234567890
column 'Sales Amount'
dataType: decimal
formatString: "$#,##0.00"
summarizeBy: sum
lineageTag: b2c3d4e5-f6a7-8901-bcde-f12345678901
column 'Order Date'
dataType: dateTime
formatString: Short Date
lineageTag: c3d4e5f6-a7b8-9012-cdef-123456789012
partition Sales = m
mode: import
source =
let
Source = Sql.Database("server", "database"),
Sales = Source{[Schema="dbo",Item="Sales"]}[Data]
in
SalesColumns
column 'Column Name'
dataType: <type>
formatString: <format>
summarizeBy: <aggregation>
isHidden
lineageTag: <guid>
annotation SummarizationSetBy = AutomaticData Types:
string- Text valuesint64- Whole numbersdecimal- Fixed decimal numbersdouble- Floating point numbersdateTime- Date and time valuesboolean- True/False valuesbinary- Binary data
Summarize By:
none- No aggregation (for dimensions)sum- Sum valuescount- Count rowsmin- Minimum valuemax- Maximum valueaverage- Average value
Measures
/// Description of the measure
/// Appears as tooltip in Power BI
measure 'Total Sales' =
SUM(Sales[Sales Amount])
formatString: "$#,##0.00"
displayFolder: Revenue
lineageTag: d4e5f6a7-b8c9-0123-def0-234567890123Calculated Columns
column 'Profit Margin' =
DIVIDE(Sales[Profit], Sales[Revenue], 0)
dataType: double
formatString: "0.00%"
lineageTag: e5f6a7b8-c9d0-1234-ef01-345678901234Relationships
relationship <guid>
fromColumn: Sales.'Product Key'
toColumn: Products.'Product Key'With additional properties:
relationship a1b2c3d4-e5f6-7890-abcd-ef1234567890
fromColumn: Sales.'Date Key'
toColumn: Date.'Date Key'
crossFilteringBehavior: bothDirections
securityFilteringBehavior: bothDirections
isActiveHierarchies
hierarchy 'Date Hierarchy'
lineageTag: f6a7b8c9-d0e1-2345-f012-456789012345
level Year
column: Year
lineageTag: a7b8c9d0-e1f2-3456-0123-567890123456
level Quarter
column: Quarter
lineageTag: b8c9d0e1-f2a3-4567-1234-678901234567
level Month
column: Month
lineageTag: c9d0e1f2-a3b4-5678-2345-789012345678File Organization
Standard File Structure
<ProjectName>.SemanticModel/
└── definition/
├── database.tmdl # Database name and compatibility
├── model.tmdl # Model-level settings
├── relationships.tmdl # All relationships
├── expressions.tmdl # Shared expressions/parameters
└── tables/
├── Sales.tmdl
├── Products.tmdl
├── Date.tmdl
└── ...One Table Per File
Each table should be in its own file named tables/<TableName>.tmdl:
table Products
lineageTag: <guid>
column 'Product Key'
dataType: int64
isKey
summarizeBy: none
lineageTag: <guid>
column 'Product Name'
dataType: string
summarizeBy: none
lineageTag: <guid>
column Category
dataType: string
summarizeBy: none
lineageTag: <guid>
partition Products = m
mode: import
source = ...Common Table Patterns
Fact Table
table 'Fact Sales'
lineageTag: <guid>
/// Foreign key to Date dimension
column 'Date Key'
dataType: int64
isHidden
summarizeBy: none
lineageTag: <guid>
/// Foreign key to Product dimension
column 'Product Key'
dataType: int64
isHidden
summarizeBy: none
lineageTag: <guid>
column 'Sales Amount'
dataType: decimal
formatString: "$#,##0.00"
summarizeBy: sum
lineageTag: <guid>
column Quantity
dataType: int64
summarizeBy: sum
lineageTag: <guid>
partition 'Fact Sales' = m
mode: import
source = ...Dimension Table
table Products
lineageTag: <guid>
column 'Product Key'
dataType: int64
isKey
isHidden
summarizeBy: none
lineageTag: <guid>
column 'Product Name'
dataType: string
summarizeBy: none
lineageTag: <guid>
column Category
dataType: string
summarizeBy: none
lineageTag: <guid>
column Subcategory
dataType: string
summarizeBy: none
lineageTag: <guid>
hierarchy 'Product Hierarchy'
lineageTag: <guid>
level Category
column: Category
lineageTag: <guid>
level Subcategory
column: Subcategory
lineageTag: <guid>
level Product
column: 'Product Name'
lineageTag: <guid>
partition Products = m
mode: import
source = ...Data Source Configuration
SQL Server
expression Server = "your-server.database.windows.net" meta [IsParameterQuery=true, Type="Text", IsParameterQueryRequired=true]
expression Database = "YourDatabase" meta [IsParameterQuery=true, Type="Text", IsParameterQueryRequired=true]Partition with SQL Source
partition Sales = m
mode: import
source =
let
Source = Sql.Database(Server, Database),
dbo_Sales = Source{[Schema="dbo",Item="Sales"]}[Data]
in
dbo_SalesPartition with SharePoint
partition Data = m
mode: import
source =
let
Source = SharePoint.Files("https://company.sharepoint.com/sites/data", [ApiVersion = 15]),
File = Source{[Name="data.xlsx"]}[Content],
Data = Excel.Workbook(File, true, true),
Sheet = Data{[Item="Sheet1",Kind="Sheet"]}[Data]
in
SheetLineage Tags
Every object needs a unique lineageTag (GUID). Generate new GUIDs for each object:
lineageTag: a1b2c3d4-e5f6-7890-abcd-ef1234567890GUIDs should be lowercase and properly formatted (8-4-4-4-12 pattern).
Boundaries and Constraints
DO
- Always use TMDL format (not JSON/BIM)
- Always include
lineageTagfor every object - Use
isHiddenfor key columns in dimension tables - Set
summarizeBy: nonefor dimension columns - Use
summarizeBy: sum(or appropriate) for measure columns - Include
isKeyon primary key columns - Add descriptions using
///comments above measures - Use single quotes for identifiers with spaces
DO NOT
- Never use implicit measures (set
discourageImplicitMeasures: true) - Never create bi-directional relationships unless required
- Never expose key columns to end users
- Never duplicate data across tables
- Never use calculated columns when measures will work
Workflow Integration
After creating tables:
- Add relationships - Define relationships between fact and dimension tables
- Add measures - Use the
daxskill to create business measures - Validate - Use the
best-practicesskill to check the model
Common Issues
"Duplicate lineageTag"
Each lineageTag must be unique. Generate a new GUID for every object.
"Invalid relationship"
- Verify column names match exactly (case-sensitive)
- Ensure data types are compatible
- Check that the "to" column is the key column
"Partition source error"
- Verify M expression syntax
- Check that data source expressions exist
- Ensure credentials are configured in Power BI Desktop
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

