sempy_labs.dax package
Module contents
- sempy_labs.dax.format_dax(dax_expression: str, display: bool = True)
Color-codes a DAX expression for display in a notebook.
Uses the DAX parser/tokenizer to classify tokens and renders them with a soft, Apple-inspired palette that reads well on both light and dark backgrounds:
Functions and keywords - soft blue
VAR-declared variables - soft teal
Numeric literals - soft orange
Virtual columns (introduced by
ADDCOLUMNS/SELECTCOLUMNS) - soft pink
- Parameters:
- Returns:
The HTML object when
display=False; otherwiseNone.- Return type:
IPython.display.HTML | None
- sempy_labs.dax.parse_dax(text: str, tom=None)
Parse a DAX expression and return its AST.
- Parameters:
text (str) – The DAX expression.
tom (TOMWrapper | Microsoft.AnalysisServices.Tabular.Model, optional) – When supplied, the parser uses the model to disambiguate bare bracketed references. A
[Name]reference resolves to aMeasurenode if a measure with that name exists, otherwise to aColumnnode withtable=None(an unqualified column) if a column with that name exists, otherwise it falls back toMeasure(the default when no model is provided).