Forum Discussion

Niels_NL's avatar
Niels_NL
Icon for Advocate I rankAdvocate I
10 years ago
Solved

Using a slicer to filter on articlegroup

Hello people,   Before I'll explain my problem, here's the datasets (incl. relevant attributes) I'm working with: Revenue 2014 table (date, articlecode, groupcode, groupname, revenuegenerated) R...
  • Twan's avatar
    10 years ago

    It sounds like there is an issue with the relationships between Revenue 2014/2016 and the date table. Because all of the revenue tables have a many to 1 relationship to the articles table and a many to 1 relationship to the date table, there can only be one active relationship all the way from Articles table to date table.  You can tell if a relationship is inactive in the model by going to the relationship view and the relationship line will be dotted instead of solid.  Here is an example of this when I created a model with your schema:

     

     

    To solve this issue you can either merge the Revenue 2014/2015/2016 tables into one revenue table so that there is only one relationship between Articles, Revenue and Date.  Or you can write the measures for Revenue 2014 and Revenue 2016 so that they explicitly use the inactive relationships.  This is done using the USERELATIONSHIP() function.  It should look close to this for your model:

    Revenue 2014 = CALCULATE(SUM('Revenue 2014'[revenuegenerated]), USERELATIONSHIP('Revenue 2014'[date], 'Date'[Date]))
    
    Revenue 2016 = CALCULATE(SUM('Revenue 2016'[revenuegenerated]), USERELATIONSHIP('Revenue 2016'[date], 'Date'[Date]))