Skip to content

Conversation

@Riktastic
Copy link
Contributor

Hi there, I wish to add Microsoft Dax. Which is a data query language used in Microsoft Power BI and Microsoft SQL Server Analysis Services.

It was recently added to Pygments: https://pygments.org/docs/lexers/#pygments.lexers.dax.DaxLexer

I've converted the Pygments lexer and added additonal function names.

Example of the format:

DEFINE
    MEASURE Sales[My Sales Amount] =
        SUM ( Sales[Sales Amount] )
    MEASURE Sales[My Double Sales Amount] =
        SUM ( Sales[Sales Amount] ) * 2
EVALUATE
ADDCOLUMNS (
    VALUES ( 'Date'[Month] ),
    "My Sales Amount", [My Sales Amount],
    "My Double Sales Amount", [My Double Sales Amount]
)

But it can also be used using this format:
Column = CALCULATE(SUM(Sales[Sales Amount]), FILTER(Date, Date[Year]=2023))

This is the first lexer I've ever added. But I have a few solid examples which should be update. A custom Notepad++ language and the Pygment lexer.

Kind regards,

Rik

@alecthomas
Copy link
Owner

Awesome, thanks! Can you add some tests as per the README in testdata/ please?

@alecthomas alecthomas merged commit 7d4db86 into alecthomas:master Nov 22, 2023
@Riktastic
Copy link
Contributor Author

Hi @alecthomas , I'm sorry have been too busy. I have planned to add the checks this weekend.

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

Labels

None yet

2 participants