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
@bjulius
Copy link
Author

bjulius commented Feb 20, 2025

For more info about this technique, here's the link to my original LinkedIn post about it:

https://bit.ly/BIMInfoWithDAX

Extract BIM Info with a single DAX Measure

@EDNAHQ
Copy link

EDNAHQ commented Feb 24, 2025

Love this!

@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