Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Creating a filtered table based on another one

Here's the link to the file   Hey there   I'd like to create a table that filters every row of my Fact table as long as the rows' dates are prior or equal to the due date (stored on its own table...
  • ThxAlot's avatar
    3 years ago

    In your data model, I didn't see any necessity of d_users since f_due_user[User_id] is a distinct column; you can built a relationship between f_due_user (1:*) Fact by [User_id].

     

    Summarized Table.pbix

    Anyway, the solution based on your current model,

    Summarized Table = 
    GENERATE(
        f_due_user,
        VAR __due = f_due_user[Due_payment]
        RETURN
            SELECTCOLUMNS(
                CALCULATETABLE(
                    SUMMARIZE( 'Fact', 'Fact'[User_id], 'Fact'[Subscription_date] ),
                    CALCULATETABLE( d_users ),
                    'Fact'[Subscription_date] <= __due
                ),
                "@subscription", 'Fact'[Subscription_date]
            )
    )