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
Power BI Copilot And Report Filters And Slicers
In my last post I talked about how to push Power BI Copilot to get answers from the semantic model rather than the report you’re looking...
Help me learn Power BI!
Introducing DAX Lib
Introducing DAX Optimizer Basic
Power BI Pro: 2-Month Weekend Corporate Mastery Program
Buy [email protected] เดฎเดฒเดฏเดพเดณเดคเตเดคเดฟเตฝ Power BI เดชเด เดฟเดเตเดเต โ GCC เดเตเดฒเดฟเดเตเดเดพเตผเดเตเดเดพเดฏเดฟ Special Training Program Career Upgrade เดเตเดฏเตเดฏเดพเตป เดเดเตเดฐเดนเดฟเดเตเดเตเดจเตเดจ GCC...
Power BI Recorded Session
Buy [email protected] เดฎเดฒเดฏเดพเดณเดคเตเดคเดฟเตฝ Power BI เดชเด เดฟเดเตเดเต โ GCC เดเตเดฒเดฟเดเตเดเดพเตผเดเตเดเดพเดฏเดฟ Special Training Program Career Upgrade เดเตเดฏเตเดฏเดพเตป เดเดเตเดฐเดนเดฟเดเตเดเตเดจเตเดจ GCC ...
