The SELECTEDMEASURE function in Power BI's DAX (Data Analysis Expressions) language is a powerful tool used primarily within calculation groups to dynamically reference the measure currently being evaluated in a report. It’s part of the calculation group feature introduced to streamline complex reporting scenarios and improve maintainability by reducing the need to duplicate measure logic. What is SELECTEDMEASURE? SELECTEDMEASURE is a DAX function that returns a reference to the measure that is currently active or "selected" in the context of a calculation group. It doesn’t take any arguments and is typically used in the expression of a calculation item within a calculation group. This allows you to write generic logic that can dynamically apply to whichever measure is being evaluated in a visual, without hardcoding specific measure names. Syntax SELECTEDMEASURE() Returns: A reference to the measure currently being evaluated in the report context. Use Case SELECTEDME...
Power BI DAX Function: INFO.VIEW.COLUMNS() INFO.VIEW.COLUMNS() is a DAX table function that returns a table containing metadata about all columns in the current Power BI semantic model. Description This function provides detailed information on each column, including: Table : The name of the table the column belongs to. Name : The column name. Description : Any description added to the column. Expression : The DAX formula if it's a calculated column (blank for regular columns). DataCategory : Category like "Time", "Image", etc. DataType : The data type of the column. IsHidden : Whether the column is hidden. And other metadata fields. It uses friendly names (e.g., table and column names instead of IDs) and is designed for ease of use compared to the base INFO.COLUMNS() function. Syntax INFO.VIEW.COLUMNS() No parameters. Returns a table. Restrictions Requires write permissions on the semantic model. ...
The USERPRINCIPALNAME function in Power BI's DAX (Data Analysis Expressions) language is used to return the user principal name of the current user accessing the report. Here's a breakdown: Function Syntax: USERPRINCIPALNAME() Explanation: User Principal Name (UPN): This is essentially an Internet-style login name for the user based on the Internet standard RFC 822. It typically has the format username@domain.com. Main Use Cases: Row-Level Security (RLS): One of the primary uses of USERPRINCIPALNAME() is in implementing row-level security within Power BI. You can use this function to dynamically filter data based on who is viewing the report. For instance, you might restrict access so that users only see data pertinent to themselves or their specific department by comparing the UPN with a column in your data model. Example: DAX SecurityFilter = 'User'[UserPrincipal...
Comments
Post a Comment