Forum Discussion

NoSayMe's avatar
NoSayMe
Regular Visitor
4 years ago
Solved

Data Model - switch relation from inactive to active by filter.

Hi, looking for help with the following ... I got 2 tables: Customers: Spending: Filter:   Filter Measures:   Data Model: Report:   I ...
  • v-yanjiang-msft's avatar
    4 years ago

    Hi NoSayMe ,

    Sorry I can't access your sample file. According to your description, I create a sample. I add some data in the Spending table like below.

    You want to show the seperate amount differentiate by own paid or friends paid for each customer.

    Here's my solution, modify the measure.

    Own money =
    CALCULATE (
        SUM ( 'Spending'[Amount] ),
        'Spending'[UsedOwnMoney] = TRUE,
        USERELATIONSHIP ( 'Spending'[CustomerID], 'Customers'[Customers_ID] )
    )
    
    Friends money =
    CALCULATE (
        SUM ( 'Spending'[Amount] ),
        'Spending'[UsedOwnMoney] = FALSE,
        USERELATIONSHIP ( 'Spending'[CustomerID], 'Customers'[Customers_ID] )
    )
    

    Get the result.

    Then if you want to ignore the who paid switch and calculate the sum amount, create a measure.

    Measure =
    CALCULATE (
        SUM ( Spending[Amount] ),
        USERELATIONSHIP ( Spending[CustomerID], 'Customers'[Customers_ID] )
    )
    

    Get the result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.