Posts

Showing posts from October, 2024

Daily DAX : Day 19 BITXOR

 This function returns a scalar value number which is the result of a bit wise OR of two numbers. Each number is converted to a binary number and positionaly a logical or is applied Syntax BITXOR (<value1>, <value2>) https://dax.guide/bitxor/

Daily DAX : Day 18 DETAILROWS

 A DAX function that returns a table with the detailed rows that a measure references Syntax DETAILROWS(<Measure>) https://dax.guide/detailrows/

Daily DAX : Day 17 AVERAGEX

 This function calculates the average of an expression on a row by row basis on a table and returns a scalar value. Syntax AVERAGEX(<Table>, <Expression>) https://dax.guide/averagex/

Daily DAX : Day 16 PDURATION

 This is a financial DAX function that returns a single scalar decimal number that indicates the number of period for an an investment to grow to a desired value given the current value and what the interest rate is. Syntax PDURATION(<Rate>, <PV>, <FV>) Where Rate is the interest rate, pv is the present value of the investment and FV is the the required future value https://dax.guide/pduration/

Daily DAX : Day 15 INFO.DICTIONARYSTORAGES

This is another DAX function that  is based on the Data Model View tables.  Returns a table that gives an indication of the storage being used Example Let’s say you’re working on a Power BI model for a retail company, analyzing their sales data. You want to understand which dictionary storages are using a significant amount of space in your model. Here’s a DAX query using INFO.DICTIONARYSTORAGES to identify dictionary storages with sizes greater than 1MB EVALUATE FILTER(     INFO.DICTIONARYSTORAGES(),     INFO.DICTIONARYSTORAGES[Size] > 1048576 ) The example output would  have the following fields : ID: Unique identifier for each dictionary storage. ColumnStorageID: Identifier for the associated column storage. Type: Indicates the type of storage (e.g., Text, Integer). DataType: Data type of the dictionary storage. DataVersion: Version of the data. BaseId: Base identifier. Magnitude: Magnitude of the storage. LastId: Last identifier used. IsNullable...

Daily DAX : Day 14 CALCULATETABLE

 This function is identical to CALCULATE but returns a table instead of a scalar value. Essentially it evaluates an expression and returns a table with the results syntax CALCULATETABLE ( <Table>, <Filter>) where table is an expression that returns a table https://dax.guide/calculatetable/

Daily DAX : Day 13 DATESYTD

 This function returns a single column table that contains all the dates from the start of the year to the date specified. Syntax DATESYTD(<Dates>, <End of Year Date>) The second parameter is optional and if not provided will generate the dates from 1st of January to 31st of December https://dax.guide/datesytd/  

Daily DAX : Day 12 COUPDAYBS

The COUPDAYBS function in DAX is used to calculate the number of days from the beginning of the coupon period to the settlement date. This is useful for bond valuation and analysis. Syntax COUPDAYBS(<settlement>, <maturity>, <frequency>, [<basis>]) where settlement : The bond's settlement date. This is the date after the issue date when the bond is traded to the buyer. maturity : The bond's maturity date. This is the date when the bond expires. frequency : The number of coupon payments per year (1, 2, or 4). basis  (optional): The type of day count basis to use (0 = US (NASD) 30/360, 1 = Actual/actual, 2 = Actual/360, 3 = Actual/365, ...

Daily DAX : Day 11 AND

 The AND function checks two logical expressions and returns a single boolean valaue (TRUE/FALSE) if BOTH logical expression return a TRUE value Syntax AND(<Logical /Expresssion  1?>,<Logical Expression 2>) e.g. to check if an amount is between 0 and 100 you could use DAX(amount >0, amount <101) would return TRUE if amount is say 50 and FALSE if amount is say 200  https://dax.guide/and/

Daily DAX : Day 10 RAND

 This function simply returns a random decimal number between 0 and 1 Syntax RAND()  https://dax.guide/rand/

Daily DAX : Day 9 COMBINEVALUES

 A dax function that returns a scalar value that combines  a series of expressions Syntax COMBINEVALUES(delimiter, expression1, expression 2, ..) E.g. Combinevalues("," Employee(LastName), Employee(FirstName) would combine the values in two columns sepearated by a comma as the delimiter : "Smith , John" https://dax.guide/combinevalues/

Daily DAX : Day 8 INFO.TABLEPERMISSIONS

  Understanding Power BI DAX: The INFO.TABLEPERMISSIONS Function What is INFO.TABLEPERMISSIONS? In Power BI's Data Analysis Expressions (DAX) language, the INFO.TABLEPERMISSIONS function is a powerful tool for analyzing table permissions within your data model. It returns a table that provides detailed information about the permissions granted to different users or groups for a specific table. Syntax and Parameters The syntax for the INFO.TABLEPERMISSIONS function is: INFO.TABLEPERMISSIONS(table) Where: table : The table for which you want to retrieve permission information. Returned Table Columns The returned table has the following columns: User Principal Name (UPN): The unique identifier of the user or group. Permission Level: The level of permission granted to the user or group. Possible values include: Read: The user or group can read data from the table. Write: The user or group can modify data in the table. ReadWrite: The user or group can both read and modify ...

Daily DAX : Day 7 TOJSON

  Unleashing the Power of DAX: Understanding the TOJSON Function What is TOJSON ? In Power BI's Data Analysis Expressions (DAX) language, the TOJSON function is a versatile tool that converts a table or expression into a JSON (JavaScript Object Notation) string. This string can then be used for various purposes, such as: Integration with external systems: Sending data to APIs or other services that accept JSON. Data visualization: Creating custom visualizations or modifying existing ones based on JSON data. Data storage: Storing data in a JSON format for later retrieval or analysis. Syntax and Parameters The syntax for the TOJSON function is TOJSON(table_or_expression) Where: table_or_expression : The table or expression you want to convert to JSON. Example: Converting a Table to JSON Let's assume we have a table named "SalesData" with the following columns: ProductName SalesAmount SalesDate Product A 1000 2023-01-01 Product B 500 2023-02-15 Product C 800 ...

Daily DAX : Day 6 SUM

 The fundamental aggregation function that sums up a column of numeric values and returns a scaler value that is the total for the column. =Sum(<Column Name>) https://dax.guide/sum/

Daily DAX : Day 5 - COUNTAX

  Mastering the COUNTAX Function in Power BI Are you looking to enhance your data analysis skills in Power BI? The  COUNTAX function  is a powerful tool that can help you count non-blank results when evaluating an expression over a table.  It's similar to the COUNTA function but is used to iterate through rows in a table and count rows where the specified expression results in a non-blank value. Syntax The syntax for the COUNTAX function is straightforward: COUNTAX(<table>, <expression>) table : The table containing the rows for which the expression will be...