Skip to content

Commit 2cff145

Browse files
authored
Merge pull request #811 from DataZoeMS/patch-8
Update info-functions-dax.md
2 parents f821bef + 73db638 commit 2cff145

21 files changed

Lines changed: 554 additions & 1 deletion

query-languages/dax/info-functions-dax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ EVALUATE
3131
)
3232
```
3333

34-
INFO functions are supported on Power BI semantic models but not on SQL Server Analysis Services models, Azure Analysis Services models, or PowerPivot models.
34+
INFO functions are supported on Power BI semantic models but not on SQL Server Analysis Services models, Azure Analysis Services models, or PowerPivot models. INFO.VIEW DAX functions can be run in calculated tables, columns, measures, and DAX queries, but other INFO DAX functions can only be run in DAX queries.
3535

3636
## INFO.VIEW DAX functions
3737

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
description: "Learn more about: INFO.VIEW.COLUMNS"
3+
title: "INFO.VIEW.COLUMNS function (DAX)"
4+
author: DataZoeMS
5+
---
6+
# INFO.VIEW.COLUMNS
7+
8+
[!INCLUDE[applies-to-measures-columns-tables-visual-calculations](includes/applies-to-measures-columns-tables-visual-calculations.md)]
9+
10+
Returns a table with information about each column in the semantic model, such as name, description, and format string. This information helps you understand the model and to self-document the model when used in calculated tables.
11+
12+
## Syntax
13+
14+
```dax
15+
INFO.VIEW.COLUMNS()
16+
```
17+
18+
## Return value
19+
20+
A table with the following columns:
21+
22+
| Column | Description |
23+
|---|---|
24+
| [ID] | The unique ID for each column in this semantic model as an integer. |
25+
| [Name] | The name of each column in this semantic model as a string. |
26+
| [Table] | The table of each column in this semantic model as a string. |
27+
| [DataType] | The data type of each column in this semantic model as a string. |
28+
| [DataCategory] | The data category of each column in this semantic model as a string. |
29+
| [Description] | The description of each column in this semantic model as a string. |
30+
| [IsHidden] | The hidden state of each column in this semantic model as True or False. |
31+
| [IsUnique] | The is unique of each column in this semantic model as True of False. |
32+
| [IsKey] | The is key of each column in this semantic model as True or False. |
33+
| [IsNullable] | The is nullable of each column in this semantic model as True or False. |
34+
| [Alignment] | The alignment of each column in this semantic model as a string. |
35+
| [SummarizeBy] | The summarize by of each column in this semantic model as a string. |
36+
| [ColumnStorage] | The column storage of each column in this semantic model as a string combination of name and ID. |
37+
| [Type] | The type of each column in this semantic model as a string. |
38+
| [SourceColumn] | The source column of each column in this semantic model as a string. |
39+
| [Expression] | The DAX formula of calculated columns. |
40+
| [FormatString] | The format string of each column in this semantic model as a string. |
41+
| [IsAvailableInMDX] | The is available in MDX of each column in this semantic model as True or False. Analyze in Excel pivot tables will only show columns set to True. |
42+
| [SortByColumn] | The sort by column of each column in this semantic model as a string. Shows as blank when sorting by itself. |
43+
| [GroupingBehavior] | The grouping behavior of each column in this semantic model as a string. |
44+
| [SourceProviderType] | The source provider type of each column in this semantic model as a string. |
45+
| [DisplayFolder] | The display folder of each column in this semantic model as a string. Nested folders shown with / and multiple folders separated by ;. |
46+
| [AlternateOf] | The alternate of property of each column in this semantic model as a string. |
47+
| [LineageTag] | The lineage tag of each column in this semantic model as a string. |
48+
49+
50+
## Remarks
51+
52+
Can only be ran by users with write permission on the semantic model and not when live connected to the semantic model in Power BI Desktop. This function can be used in calculated tables, columns, and measures of a semantic model and will update when the model is refreshed.
53+
54+
## Example 1 - DAX query
55+
56+
The following DAX query can be run in [DAX query view](/power-bi/transform-model/dax-query-view):
57+
58+
```dax
59+
EVALUATE
60+
INFO.VIEW.COLUMNS()
61+
```
62+
63+
This DAX query returns a table with all of the columns of this DAX function.
64+
65+
## Example 2 - DAX query with SELECTCOLUMNS and FILTER
66+
67+
The following DAX query can be run in [DAX query view](/power-bi/transform-model/dax-query-view):
68+
69+
```dax
70+
EVALUATE
71+
// Select specific columns from the filtered result
72+
SELECTCOLUMNS(
73+
// Filter columns from the INFO.VIEW.COLUMNS() table
74+
FILTER(
75+
INFO.VIEW.COLUMNS(),
76+
// Exclude rows where DataCategory is "RowNumber" and Table is "xTables"
77+
[DataCategory] <> "RowNumber" && [Table] <> "xTables"
78+
),
79+
// Show only these selected columns with new names where specified
80+
[Table],
81+
"Column", [Name],
82+
[Description],
83+
"DAX formula", [Expression],
84+
[DataCategory],
85+
[DataType],
86+
[IsHidden]
87+
)
88+
// Order the result by Table and then by Column
89+
ORDER BY
90+
[Table], [Column]
91+
```
92+
93+
This DAX query returns a table with only the specified columns and rows meeting the filter condition with a DAX formula.
94+
95+
:::image type="content" source="media/info-view-columns-function-dax/dax-query-example-2.png" alt-text="Screenshot showing the output of INFO.VIEW.COLUMNS() with selected columns in DAX query view." lightbox="media/info-view-columns-function-dax/dax-query-example-2.png":::
96+
97+
## Example 3 - calculated table with SELECTCOLUMNS and FILTER
98+
99+
Either of the above examples work in a calculated table when the EVALUATE and ORDER BY keywords are removed and a table name added. Here is example 2 in a calculated table:
100+
101+
```dax
102+
Columns in this semantic model =
103+
// Select specific columns from the filtered result
104+
SELECTCOLUMNS(
105+
// Filter columns from the INFO.VIEW.COLUMNS() table
106+
FILTER(
107+
INFO.VIEW.COLUMNS(),
108+
// Exclude rows where DataCategory is "RowNumber" and Table is "xTables"
109+
[DataCategory] <> "RowNumber" && [Table] <> "xTables"
110+
),
111+
// Show only these selected columns with new names where specified
112+
[Table],
113+
"Column", [Name],
114+
[Description],
115+
"DAX formula", [Expression],
116+
[DataCategory],
117+
[DataType],
118+
[IsHidden]
119+
)
120+
```
121+
This calculated table shows the same information as the DAX query in example 2 in a table in the model itself.
122+
123+
## Example 4 - measure
124+
125+
The following measure can be added to count the number of text columns in a semantic model:
126+
127+
```dax
128+
Number of text columns =
129+
COUNTROWS(
130+
FILTER(
131+
INFO.VIEW.COLUMNS(),
132+
[DataType] = "Text"
133+
)
134+
)
135+
```
136+
This will show a scalar value with the number of text columns in my model.
137+
138+
This can be shown in a visual:
139+
140+
:::image type="content" source="media/info-view-columns-function-dax/measure-example-4-visuals.png" alt-text="Screenshot showing the output of INFO.VIEW.COLUMNS() with a measure then used in report visuals." lightbox="media/info-view-columns-function-dax/measure-example-4-visuals.png":::
141+
142+
Or a DAX query in [DAX query view](/power-bi/transform-model/dax-query-view):
143+
144+
```dax
145+
DEFINE
146+
MEASURE 'Columns in this semantic model'[Number of text columns] =
147+
COUNTROWS(
148+
FILTER(
149+
INFO.VIEW.COLUMNS(),
150+
[DataType] = "Text"
151+
)
152+
)
153+
154+
EVALUATE
155+
SUMMARIZECOLUMNS(
156+
"Number of text columns", [Number of text columns]
157+
)
158+
```
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
description: "Learn more about: INFO.VIEW.MEASURES"
3+
title: "INFO.VIEW.MEASURES function (DAX)"
4+
author: DataZoeMS
5+
---
6+
# INFO.VIEW.MEASURES
7+
8+
[!INCLUDE[applies-to-measures-columns-tables-visual-calculations](includes/applies-to-measures-columns-tables-visual-calculations.md)]
9+
10+
Returns a table with information about each measure in the semantic model, such as name, description, and DAX formula. This information helps you understand the model and to self-document the model when used in calculated tables.
11+
12+
## Syntax
13+
14+
```dax
15+
INFO.VIEW.MEASURES()
16+
```
17+
18+
## Return value
19+
20+
A table with the following columns:
21+
22+
| Column | Description |
23+
|---|---|
24+
| [ID] | The unique ID for each measure in this semantic model as an integer. |
25+
| [Name] | The name of each measure in this semantic model as a string. |
26+
| [Table] | The home table of each measure in this semantic model as a string. |
27+
| [Description] | The description of each measure in this semantic model as a string. |
28+
| [DataType] | The data type of each measure in this semantic model as a string. Measures are usually variant data type. |
29+
| [Expression] | The DAX formula of each measure in this semantic model. |
30+
| [FormatString] | The format string of each measure in this semantic model as a string. |
31+
| [IsHidden] | The hidden state of each measure in this semantic model as True or False. |
32+
| [State] | The state (such as valid or error) of each measure in this semantic model as a string. |
33+
| [KPIID] | The KPI ID of each measure in this semantic model as an integer. |
34+
| [IsSimpleMeasure] | The simple measure flag of each measure in this semantic model as True of False. |
35+
| [DisplayFolder] | The display folder of each measure in this semantic model as a string. Nested folders shown with / and multiple folders separated by ;. |
36+
| [DetailRowsDefinition] | The details rows definition of each measure in this semantic model. |
37+
| [DataCategory] | The data category of each measure in this semantic model as a string. |
38+
| [FormatStringDefinition] | The dynamic format string of each measure in this semantic model. |
39+
| [LineageTag] | The lineage tag of each measure in this semantic model as a string. |
40+
41+
## Remarks
42+
43+
Can only be ran by users with write permission on the semantic model and not when live connected to the semantic model in Power BI Desktop. This function can be used in calculated tables, columns, and measures of a semantic model and will update when the model is refreshed.
44+
45+
## Example 1 - DAX query
46+
47+
The following DAX query can be run in [DAX query view](/power-bi/transform-model/dax-query-view):
48+
49+
```dax
50+
EVALUATE
51+
INFO.VIEW.MEASURES()
52+
```
53+
54+
This DAX query returns a table with all of the columns of this DAX function.
55+
56+
:::image type="content" source="media/info-view-measures-function-dax/dax-query-example-1.png" alt-text="Screenshot showing the output of INFO.VIEW.MEASURES() in DAX query view." lightbox="media/info-view-measures-function-dax/dax-query-example-1.png":::
57+
58+
## Example 2 - DAX query with SELECTCOLUMNS
59+
60+
The following DAX query can be run in [DAX query view](/power-bi/transform-model/dax-query-view):
61+
62+
```dax
63+
EVALUATE
64+
SELECTCOLUMNS(
65+
INFO.VIEW.MEASURES(),
66+
"Home table", [Table],
67+
"Measure", [Name],
68+
[Description],
69+
"DAX formula", [Expression],
70+
[State]
71+
)
72+
```
73+
74+
This DAX query returns a table with only the specified columns.
75+
76+
:::image type="content" source="media/info-view-measures-function-dax/dax-query-example-2.png" alt-text="Screenshot showing the output of INFO.VIEW.MEASURES() with selected columns in DAX query view." lightbox="media/info-view-measures-function-dax/dax-query-example-2.png":::
77+
78+
## Example 3 - calculated table with SELECTCOLUMNS
79+
80+
Either of the above examples work in a calculated table when the EVALUATE keyword is removed and a table name added. Here is example 2 in a calculated table:
81+
82+
```dax
83+
Measures in this semantic model =
84+
SELECTCOLUMNS(
85+
INFO.VIEW.MEASURES(),
86+
"Home table", [Table],
87+
"Measure", [Name],
88+
[Description],
89+
"DAX formula", [Expression],
90+
[State]
91+
)
92+
```
93+
This calculated table shows the same information as the DAX query in example 2 in a table in the model itself.
94+
95+
## Example 4 - measure
96+
97+
The following measure can be added to count the number of text columns in a semantic model:
98+
99+
```dax
100+
Number of measures =
101+
COUNTROWS( INFO.VIEW.MEASURES() )
102+
```
103+
This will show a scalar value with the number of measures in my model.
104+
105+
This can be shown in a visual:
106+
107+
:::image type="content" source="media/info-view-measures-function-dax/measure-example-4-visuals.png" alt-text="Screenshot showing the output of INFO.VIEW.MEASURES() with a measure then used in report visuals." lightbox="media/info-view-measures-function-dax/measure-example-4-visuals.png":::
108+
109+
Or a DAX query in [DAX query view](/power-bi/transform-model/dax-query-view):
110+
111+
```dax
112+
DEFINE
113+
MEASURE 'Measures in this semantic model'[Number of measures] = COUNTROWS( INFO.VIEW.MEASURES() )
114+
115+
EVALUATE
116+
SUMMARIZECOLUMNS(
117+
"Number of measures", [Number of measures]
118+
)
119+
```
120+
121+
:::image type="content" source="media/info-view-measures-function-dax/measure-example-4-dax-query.png" alt-text="Screenshot showing the output of INFO.VIEW.MEASURES() with a measure then used in a DAX query in DAX query view." lightbox="media/info-view-measures-function-dax/measure-example-4-dax-query.png":::

0 commit comments

Comments
 (0)