Basics of Modeling in Power BI: Fact Tables.What is a Dimension table and why say No to a single big table.Data preparation First and Foremost Important task.What is the Direction of the Relationship?.What is the Cardinality of the Relationship?.If you haven't read other parts of Back to Basics Series of Power BI Modeling, here they are: Then use that measure as the visual level filter of the visual, and set the filter to be greater than zero (or what is the threshold of having an activity in the fact table). So in summary, the simple trick is to create a measure that calculates a value from the fact table. However, using a measure like above normally is not necessary, because as you have seen the simple measure works like a charm. If a simple expression like above doesn’t work, you can take one step further and create a measure using CrossFilter function such as below Filter Product = This method is not just for slicers, it can work for any other visuals too. You can use this measure also to filter the customer slicer based on the product slicer if you want it the other way around. This means that now the Customer slicer can filter the product slicer, without having the both-directional relationship in the data model. This means that only show Product Colors that there are sales for them based on the current selection of other slicers in the report. You can use this measure in the Product slicer (Color slicer) as a visual level filter and set the value to be greater than zero. This is a very simple measure that calculates the sum of the SalesAmount from the fact table. You can create a measure like this: Sales = SUM(FactInternetSales) The second problem is that you cannot apply both-directional relationship all the time, it brings circular reference and ambiguity to your data model.Īnother option is to use measures as a filter, which is what I called here as Filter Measures. The first problem is the significant performance impact of this. Why not both-directional relationship?īoth-directional relationship comes with two major problems. Another is to use Measures for filtering. One is to use both-directional relationship (which I don’t recommend). If you have this requirement that one dimension should get filtered by another dimension, there are two ways to implement it. This is normally the case that in a star-schema, the fact table is in the middle, and gets filtered by all dimensions, but dimensions can’t filter each other. I have written a full article explaining the direction of the relationship and I recommend you to read it here. You may ask why the product slicer doesn’t get filtered? The reason is that the direction of the relationship is from the Product table to the Fact table, which means only the product table can filter the fact table’s data, not the other way around. Why Filtering Doesn’t Happen Automatically? What if your requirement is to filter the Color slicer based on only products that the selected customer have purchased? In the above report, the Product slicer doesn’t get filtered by selection of the Customer slicer. But what about other scenarios? Only showing Products that this customer purchased In the report above, with selection of the FullName (from the DimCustomer table) slicer, or Color (from the DimProduct table), the table visual gets filtered. The sample dataset for this example has only three tables below: ( download the Power BI file at the end of the article)ĭimCustomer and DimProduct both have one-to-many single directional relationship to the FactInternetSales. The question is that both my dimensions are filtering my fact table values, but how can I get one dimension filtering another dimension? for example, how can I get only the list of products that have been purchased by this customer? In this article, I’ll explain how you can do that with the star-schema. I often get this question after I explain about the star-schema.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |