Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Microsoft Dax #889

Merged
merged 1 commit into from
Nov 22, 2023
Merged

Add Microsoft Dax #889

merged 1 commit into from
Nov 22, 2023

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
2 checks passed
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants