How to implement a view slicer in Power BI



The core entity in Real Estate industry is building. Business likes to analyze building performance from various perspectives on one dashboard. 
One typical scenario is: showing measures by different level in building geography hierarchy. Here is how the sample looks like:
When users select "Country", the table shows the list of country and sum of building area by each country.

When user select "Province", the tables shows the list of provinces and sum of building area by each province:


Let's take a look at the backend. It's all driven  from a "Building" table. for example, the building table has 5 attributes:

First step, we need to create a reference table from the building table and then unpivot city, province and country. The result should look like this:



Then we give the "attribute" a meaningful name "Geography Level". And this is the final version:




Now, we have two tables in Power BI data model:


And we should create a connection between these two tables and make sure it's active in "both". This is the most important part that makes the Geography Level slicer working properly!

Then you can add whatever calculated measures in building table.  All measures should work perfectly as what we expected.


Comments