|
| 1 | +--- |
| 2 | +description: "Learn more about: INFO.ANNOTATIONS" |
| 3 | +title: "INFO.ANNOTATIONS function (DAX)" |
| 4 | +author: DataZoeMS |
| 5 | +--- |
| 6 | +# INFO.ANNOTATIONS |
| 7 | + |
| 8 | +[!INCLUDE[applies-to-query-only](includes/applies-to-query-only.md)] |
| 9 | + |
| 10 | +Returns a table with information about each annotation in the semantic model. This information helps you understand the model. |
| 11 | + |
| 12 | +## Syntax |
| 13 | + |
| 14 | +```dax |
| 15 | +INFO.ANNOTATIONS([<Restriction name>, <Restriction value>], ...) |
| 16 | +``` |
| 17 | + |
| 18 | +[!INCLUDE[parameters-for-info-dax-functions](includes/parameters-for-info-dax-functions.md)] |
| 19 | + |
| 20 | +## Return value |
| 21 | + |
| 22 | +A table with the following columns: |
| 23 | + |
| 24 | +| Column | Description | |
| 25 | +|---|---| |
| 26 | +| [ID] | A reference to the object. IDs are usually autogenerated and should not be changed after the model is created. Data type is unsigned long (4 bytes). | |
| 27 | +| [ObjectID] | A reference to the object that owns this Annotation. | |
| 28 | +| [ObjectType] | A reference to the type of object that owns this Annotation. | |
| 29 | +| [Name] | The name of the object, used in code, script, and queries. | |
| 30 | +| [Value] | The value of the annotation. | |
| 31 | +| [ModifiedTime] | The time that the object was last modified. | |
| 32 | + |
| 33 | +## Remarks |
| 34 | + |
| 35 | +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 [DAX queries](/dax/dax-queries), and can't be used in calculations. |
| 36 | + |
| 37 | +## Example 1 - DAX query |
| 38 | + |
| 39 | +The following DAX query can be run in [DAX query view](/power-bi/transform-model/dax-query-view): |
| 40 | + |
| 41 | +```dax |
| 42 | +EVALUATE |
| 43 | + INFO.ANNOTATIONS() |
| 44 | +``` |
| 45 | + |
| 46 | +This DAX query returns a table with all of the columns of this DAX function. |
| 47 | + |
| 48 | +## Example 2 - DAX query with joins |
| 49 | + |
| 50 | +The following DAX query can be run in [DAX query view](/power-bi/transform-model/dax-query-view): |
| 51 | + |
| 52 | +```dax |
| 53 | +EVALUATE |
| 54 | + VAR _ObjectTypeEnum = |
| 55 | + DATATABLE( |
| 56 | + "ObjectType",INTEGER, |
| 57 | + "Object",STRING, |
| 58 | + { |
| 59 | + {0,"Null"}, |
| 60 | + {1,"Model"}, |
| 61 | + {2,"DataSource"}, |
| 62 | + {3,"Table"}, |
| 63 | + {4,"Column"}, |
| 64 | + {5,"AttributeHierarchy"}, |
| 65 | + {6,"Partition"}, |
| 66 | + {7,"Relationship"}, |
| 67 | + {8,"Measure"}, |
| 68 | + {9,"Hierarchy"}, |
| 69 | + {10,"Level"}, |
| 70 | + {11,"Annotation"}, |
| 71 | + {12,"KPI"}, |
| 72 | + {13,"Culture"}, |
| 73 | + {14,"ObjectTranslation"}, |
| 74 | + {15,"LinguisticMetadata"}, |
| 75 | + {29,"Perspective"}, |
| 76 | + {30,"PerspectiveTable"}, |
| 77 | + {31,"PerspectiveColumn"}, |
| 78 | + {32,"PerspectiveHierarchy"}, |
| 79 | + {33,"PerspectiveMeasure"}, |
| 80 | + {34,"Role"}, |
| 81 | + {35,"RoleMembership"}, |
| 82 | + {36,"TablePermission"}, |
| 83 | + {37,"Variation"}, |
| 84 | + {38,"Set"}, |
| 85 | + {39,"PerspectiveSet"}, |
| 86 | + {40,"ExtendedProperty"}, |
| 87 | + {41,"Expression"}, |
| 88 | + {42,"ColumnPermission"}, |
| 89 | + {43,"DetailRowsDefinition"}, |
| 90 | + {44,"RelatedColumnDetails"}, |
| 91 | + {45,"GroupByColumn"}, |
| 92 | + {46,"CalculationGroup"}, |
| 93 | + {47,"CalculationItem"}, |
| 94 | + {48,"AlternateOf"}, |
| 95 | + {49,"RefreshPolicy"}, |
| 96 | + {50,"FormatStringDefinition"} |
| 97 | + } |
| 98 | + ) |
| 99 | +
|
| 100 | + VAR _INFO = |
| 101 | + INFO.ANNOTATIONS() |
| 102 | +
|
| 103 | + VAR _CombinedTable = |
| 104 | + NATURALLEFTOUTERJOIN( |
| 105 | + _INFO, |
| 106 | + _ObjectTypeEnum |
| 107 | + ) |
| 108 | +
|
| 109 | + VAR _ModelObjects = |
| 110 | + UNION( |
| 111 | + SELECTCOLUMNS( |
| 112 | + INFO.MEASURES(), |
| 113 | + "ObjectID", [ID], |
| 114 | + "Object Name", [Name] |
| 115 | + ), |
| 116 | + SELECTCOLUMNS( |
| 117 | + INFO.TABLES(), |
| 118 | + "ObjectID", [ID], |
| 119 | + "Object Name", [Name] |
| 120 | + ), |
| 121 | + SELECTCOLUMNS( |
| 122 | + INFO.COLUMNS(), |
| 123 | + "ObjectID", [ID], |
| 124 | + "Object Name", [ExplicitName] |
| 125 | + ), |
| 126 | + SELECTCOLUMNS( |
| 127 | + INFO.EXPRESSIONS(), |
| 128 | + "ObjectID", [ID], |
| 129 | + "Object Name", [Name] |
| 130 | + ), |
| 131 | + SELECTCOLUMNS( |
| 132 | + INFO.MODEL(), |
| 133 | + "ObjectID", [ID], |
| 134 | + "Object Name", [Name] |
| 135 | + ) |
| 136 | + ) |
| 137 | +
|
| 138 | + VAR _CombinedTable2 = |
| 139 | + NATURALLEFTOUTERJOIN( |
| 140 | + _CombinedTable, |
| 141 | + _ModelObjects |
| 142 | + ) |
| 143 | +
|
| 144 | + RETURN |
| 145 | + SELECTCOLUMNS( |
| 146 | + _CombinedTable2, |
| 147 | + "Object type", [Object], |
| 148 | + "Object", [Object Name], |
| 149 | + "Annotation name", [Name], |
| 150 | + "Annotation value", [Value] |
| 151 | + ) |
| 152 | + ORDER BY [Annotation name] |
| 153 | +``` |
| 154 | + |
| 155 | +This DAX query returns a table with only the specified columns and joining to other INFO DAX functions and the enumeration table. |
| 156 | + |
| 157 | +[!INCLUDE[enum-title-for-info-dax-functions](includes/enum-title-for-info-dax-functions.md)] |
| 158 | + |
| 159 | +[!INCLUDE[enum-objecttype](includes/enum-objecttype.md)] |
0 commit comments