-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfxPathContains.pq
41 lines (40 loc) · 1.29 KB
/
fxPathContains.pq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// fxPathContains
// --------------------------- Function ------------------------------
let
fxPathContains = (
Path as text,
Item as text
) as logical =>
let
// Split the path by delimiter "|" into a list
PathList = Text.Split(Path, "|"),
// Check if the item is in the list
ContainsItem = List.Contains(PathList, Item)
in
ContainsItem,
// --------------------------- Documentation segment ------------------------------
documentation = [
Documentation.Name = "fxPathContains",
Documentation.Description = "This function checks if a specified item is present within a hierarchical path, similar to the DAX PATHCONTAINS function.",
Documentation.Source = "Custom Function",
Documentation.Version = "1.0",
Documentation.Author = "",
Documentation.Examples =
{
[
Description = "Check if the path '1|4' contains the item '4'",
Code = "fxPathContains(""1|4"", ""4"")",
Result = "true"
]
}
]
// --------------------------- Output ----------------------------------------------
in
Value.ReplaceType(
fxPathContains,
Value.ReplaceMetadata(
Value.Type(fxPathContains),
documentation
)
)
// ------------------------------------------------------------------------------------