PATHITEMREVERSE

How to Use the Power BI DAX function PATHITEMREVERSE

In this article, we will explore the PATHITEMREVERSE function in DAX and how it can be useful in analyzing data in Power BI.

What is PATHITEMREVERSE Function in DAX?

The PATHITEMREVERSE function in DAX is used to extract a specific value from a path that is defined by a delimiter. This function is commonly used in hierarchical data structures where data is stored in a parent-child relationship.

Syntax of PATHITEMREVERSE Function

The syntax for the PATHITEMREVERSE function is as follows:


PATHITEMREVERSE ( ❰Path❱, ❰Index❱ )


– `Path`: The path that contains the value to be extracted.

– `Index`: The position of the value to be extracted from the end of the path.

Example Use Case

Suppose we have a table in our Power BI report that contains data about sales transactions. The table has the following columns: Transaction ID, Date, Product Category, Product Subcategory and Sales Amount.

We want to create a new column that will show the parent category of each product subcategory. To do this, we will use the PATH function to create a path that shows the full hierarchy of each product subcategory.


Path = PATH(Product[Product Subcategory], Product[Product Category])


The PATH function will create a string that shows the full hierarchy of each product subcategory separated by a delimiter. For example, the path for a product subcategory called “Bikes” might be “Bikes|Cycling”.

Now, we can use the PATHITEMREVERSE function to extract the parent category from the path.


Parent Category = PATHITEMREVERSE(Product[Path], 1)


The PATHITEMREVERSE function will extract the value that is one position from the end of the path. In this case, it will extract the parent category.

The PATHITEMREVERSE function is a powerful tool in the DAX language that can be used to extract specific values from a path that is defined by a delimiter. This function is especially useful in hierarchical data structures where data is stored in a parent-child relationship.

In Power BI, the PATHITEMREVERSE function can be used to create custom calculations and formulas that allow users to analyze data in new and innovative ways. By mastering the DAX language and its powerful functions like PATHITEMREVERSE, users can gain valuable insights into their data and make informed decisions that drive business success.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)