You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _mydocs/contribute/index.md
+46-1Lines changed: 46 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,52 @@ title: Contribute to DAX Lib
4
4
menu_title: Contribute
5
5
published: true
6
6
date: 2025-08-14
7
-
modified: 2025-08-14
7
+
modified: 2025-08-25
8
8
order: /02
9
9
next_reading: true
10
10
---
11
+
12
+
A DAX library is deployed as a package in DAX Lib. A package is a ZIP file that includes a few files (**TODO add package description**).
13
+
14
+
You can follow these steps to add a new package to DAX Lib:
15
+
16
+
1.**Clone** the GitHub repository [https://github.com/sql-bi/daxlib/](https://github.com/sql-bi/daxlib/).
17
+
18
+
2.**Create a folder** for your package in `/packages/`, for example by copying the daxlib.sample package.
19
+
20
+
a. Name the folder after your package using lowercase names (e.g., `test.functions`), while the package should have a pascal naming convention (e.g., `Test.Functions`).
21
+
22
+
b. The package and library name is the prefix of all the function names. For example, to functions `Sum` and `Multiply` in the `Test.Functions` library package should be named `Test.Functions.Sum` and `Test.Functions.Multiply`.
23
+
24
+
c. The package and library name must have a hierarchical nomenclature, where the first name is the published/author identifier and the second (and following) names identify the library scope. For example, `Contoso.Conversion` is a library of conversion functions made by Contoso, whereas `Northwind.Math.Geometry` is a set of geometrical mathematical functions made by Northwind.
25
+
26
+
d. Do not use `Dax.` in the name of the library (Dax as a single word is a reserved keyword in a function name).
27
+
28
+
e. `DaxLib.` as a prefix is a reserved word for public open-source libraries of common use that are reviewed and approved by DaxLib maintainers. Do not create pull request for new `DaxLib.` libraries.
29
+
30
+
f. The first level in the folder structure is a single letter corresponding to the first letter of the package name (for example, a package `test.functions` will be in `/packages/t/test.functions/` folder). This is a technique used to reduce the number of elements in a single folder.
31
+
32
+
g. All the names of folders and files must be lowercase; the name of the package (with uppercase letters if necessary) is defined in the metadata (`manifest.daxlib` file) of the package.
33
+
34
+
3.**Create the DAX functions** in `functions.tmdl`
35
+
36
+
a. The file `lib/functions.tmdl` contains the source code of the DAX functions in a TMDL createOrReplace command. For example, in `test.functions` the name is `/packages/t/test.functions/lib/functions.tmdl`
37
+
38
+
b. The `functions.tmdl` file contains the function definition using the TMDL syntax following the `createOrReplace` statement
39
+
40
+
c. Include mandatory annotations for each function of the library:
41
+
42
+
annotation DAXLIB_PackageId = <name of library>`
43
+
annotation DAXLIB_PackageVersion = <version of library>
44
+
45
+
4.**Create the manifest** in the `manifest.daxlib` file
46
+
47
+
a. For example, in `test.functions` the name is `/packages/t/test.functions/manifest.daxlib`
48
+
49
+
b. The `manifest.daxlib` file includes the properties of the package in JSON format. See [https://daxlib.org/package/DaxLib.Sample/#code](https://daxlib.org/package/DaxLib.Sample/#code) to get an example
50
+
51
+
5.**Create a pull request** to publish the library on daxlib.org
52
+
53
+
a. The pull request must be approved manually by DaxLib owners/maintainers.
54
+
55
+
b. When the pull request is approved, the package is immediately published.
[DaxLib.Client](https://www.nuget.org/packages/DaxLib.Client) is the NuGet package that can be used by external tools to integrate with [DaxLib](https://daxlib.org) directly:
13
+
- Create packages
14
+
- Download packages
15
+
16
+
**NOTE**: Currently, the client does not add the functions to the semantic model, the external tool does that (like Tabular Editor). However, this feature will be added soon in the client before the integration with [Bravo for Power BI](https://bravo.bi).
Copy file name to clipboardExpand all lines: _mydocs/user-guide/add-to-power-bi.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,20 @@ layout: page
3
3
title: Add to Power BI
4
4
published: true
5
5
date: 2025-08-14
6
-
modified: 2025-08-14
6
+
modified: 2025-08-25
7
7
order: /user-guide/02
8
8
---
9
+
10
+
When you click the **Add to Power BI** button, you can copy the DAX library code to your clipboard and then paste it into the TMDL View of your Power BI semantic model.
11
+
12
+
1.*(optional)* With the **Show Code** button, you can view the code of the library before clicking **Copy** . This way, you can inspect the library code before moving forward.
13
+
14
+
2. After you click **Copy**, the code will be copied to your clipboard.
15
+
16
+
3. In Power BI, **open the TMDL View** of your semantic model.
17
+
18
+
4. In the TMDL view, and **paste** the code into the editor (CTRL+V).
19
+
20
+
5. Click **Apply** in the TMDL View.
21
+
22
+
6. Done! You can start using the functions in any DAX expression of your semantic model.
Copy file name to clipboardExpand all lines: _mydocs/user-guide/index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@ layout: page
3
3
title: User Guide
4
4
published: true
5
5
date: 2025-08-14
6
-
modified: 2025-08-14
6
+
modified: 2025-08-25
7
7
order: /01
8
8
next_reading: true
9
9
---
10
10
11
-
This document provides a collection of user guides for the DAX Lib services. These guides are designed to help you understand how to use the various features and functionalities of DAX Lib effectively.
11
+
This document provides a collection of user guides for the DAX Lib services. These guides are designed to help you understand how to use the various features and functionalities of DAX Lib.
Copy file name to clipboardExpand all lines: _mydocs/what-is.md
+41-1Lines changed: 41 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,47 @@ layout: page
3
3
title: What is DAX Lib?
4
4
published: true
5
5
date: 2025-08-14
6
-
modified: 2025-08-14
6
+
modified: 2025-08-25
7
7
order: /001
8
8
next_reading: true
9
9
---
10
+
11
+
DAX Lib is a website designed to distribute libraries of DAX user-defined functions (UDF). Similar to NuGet, DAX Lib provides a centralized platform where users can discover, share, and download reusable DAX function libraries to enhance their Fabric, Power BI, and Analysis Services semantic models.
12
+
13
+
# DAX libraries
14
+
A DAX library is a collection of DAX user-defined functions that can be reused across different semantic models, promoting best practices and reducing duplication of effort.
15
+
16
+
## Functions designed for DAX libraries
17
+
A DAX user-defined function is candidate for a library if it is model-independent, which means that it has no references to specific tables, columns, or measures within a particular model. When a function has direct dependencies on model elements, it is not suitable for inclusion in a DAX library and must be refactored to remove those dependencies.
18
+
19
+
Example of a **model-independent function**, good candidate for a DAX library:
20
+
```DAX
21
+
FUNCTION RangeLookup = (
22
+
search : SCALAR VAL,
23
+
lookupTable : TABLEREF EXPR,
24
+
colMin : COLUMNREF EXPR,
25
+
colMax : COLUMNREF,
26
+
colTarget : COLUMNREF
27
+
) =>
28
+
SELECTCOLUMNS (
29
+
FILTER (
30
+
lookupTable,
31
+
colMin <= search && colMax > search
32
+
),
33
+
"@Result", colTarget
34
+
)
35
+
```
36
+
37
+
Example of a **model-dependent function**, which could be defined in a semantic model to simplify the consumption of a generic function imported from a DAX library:
0 commit comments