Why DAX Can't Directly Reference Hierarchies in Power BI?

π What is a Hierarchy in Power BI?
A hierarchy in Power BI is a structured arrangement of related columns that allows users to drill down from a higher-level category to a more detailed level.
πΉ Example of a Hierarchy
Consider a Date Hierarchy:
- Year β Quarter β Month β Day
Or a Geography Hierarchy:
- Country β State β City
π« Why Canβt DAX Refer to a Hierarchy or Hierarchy Level?
DAX can only reference columns, measures, and tables, but not hierarchy objects directly. This is because a hierarchy is a UI feature in Power BI, not an actual data model object.
However, you can reference each level of the hierarchy individually using its column name.
β Alternative Approach Using DAX
If you want to calculate something for a specific level in a hierarchy, you must use the underlying column:
πΈ Example: Total Sales by Year (from Date Hierarchy)
TotalSalesByYear = CALCULATE(SUM(Sales[Revenue]), VALUES(Sales[Year]))
This formula references Sales[Year], not the entire hierarchy.
Published on:
Learn moreRelated posts
Unlock Effortless DAX Testing Like Never Before!
Conditional Chart Visibility in Power BI✌🏼
Mastering Data Governance in Power BI: Ensuring Accuracy, Security, and Compliance
Table of Contents Introduction Having access to insightful analytics tools like Power BI can transform decision-making processes. But without ...
Speed Up Dataflow Publishing/ Validation Times In Power BI And Fabric
If you’re working with slow data sources in Power BI/Fabric dataflows then you’re probably aware that validation (for Gen1 dataflo...