Skip to content

Instantly share code, notes, and snippets.

@bjulius
Last active April 16, 2025 01:47
Show Gist options
  • Save bjulius/bbe97b5a954fc15fd58dea76e066e5b4 to your computer and use it in GitHub Desktop.
Save bjulius/bbe97b5a954fc15fd58dea76e066e5b4 to your computer and use it in GitHub Desktop.
DAX Measure to Extract Data Model Info for Prompting AI
BIM Info =
VAR TableInfo =
ADDCOLUMNS (
INFO.VIEW.TABLES (),
"Component", "Tables"
)
VAR ColumnInfo =
ADDCOLUMNS (
INFO.VIEW.COLUMNS (),
"Component", "Columns"
)
VAR RelationshipInfo =
ADDCOLUMNS (
INFO.VIEW.RELATIONSHIPS (),
"Component", "Relationships"
)
VAR MeasureInfo =
ADDCOLUMNS (
INFO.VIEW.MEASURES (),
"Component", "Measures"
)
VAR Result =
TOCSV ( TableInfo )
& TOCSV ( ColumnInfo )
& TOCSV ( RelationshipInfo )
& TOCSV ( MeasureInfo )
RETURN
Result
// Authored by Brian Julius, Feb 2025
@maxanatsko
Copy link

There seems to be either limit to output size, or TOCSV (tried TOJSON as well) trips over some special characters - in large model I'm getting just few percent of Measures data, it is severely truncated.
Doesn't happen when I run INFO.VIEW.MEASURES directly.
@bjulius have you encountered this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment