Forum Discussion

Shubhangi18's avatar
Shubhangi18
New Member
3 months ago
Solved

Hierarchy Slicer Metadata for Auto Date/Time Hierarchies in Power BI Embedded

We are using getSlicerState() to retrieve hierarchy slicer selection details. For hierarchy slicers, the API currently returns target like: { "table": "FactSales", "hierarchy": "Date Hierarchy"...
  • Anonymous's avatar
    Anonymous
    3 months ago

    Hi Shubhangi18 ,

     

    Thank you for your follow up.

    To clarify, when referring to a dedicated Date table and custom hierarchies, you would retain your existing columns Column A, Column B, and Column C as they are, without removing or migrating any data. There is no risk of data loss.

    The main issue is that Auto Date Time generates hidden date tables and hierarchies, which are exposed in the Embedded API only as Date Hierarchy, without linking back to the original columns. Since these LocalDateTables are not accessible via the API, it is not currently possible to determine whether a selection originated from Column A, Column B, or Column C.

    The recommended approach is to modify the report's model by creating custom hierarchies with distinct names and using those in the slicer. For example, you could define separate hierarchies for Order Date, Ship Date, and Invoice Date. These custom hierarchies are identifiable through the API, enabling you to pinpoint the source context.

    If your report currently uses Auto Date Time hierarchies, there is no supported API method to map a hierarchy slicer back to its underlying date column. In this case, updating the report to use custom date hierarchies is the only reliable solution to avoid ambiguity.

    In summary, the recommendation is to keep your existing date columns and replace the Auto Date Time hierarchy objects with custom hierarchies that can be uniquely identified through the API.

    Thank you.