Forum Discussion

at01's avatar
at01
Frequent Visitor
5 years ago
Solved

Questions about how to combine multiple tables into one visualisation

Hello,   I am new to Power BI in general and to Power Query as well.    I have the following situation:  3 different tables: Customers, Communication and sales:   Customer:   Customer ID Las...
  • AlB's avatar
    5 years ago

    Hi at01 

    I do not understand what you want to do in the chart.

    You do not necessarily need to merge any table. You could create a calculated column in the Sales table:

     

    Com sent priot to purchase = 
    IF (
        CALCULATE (
            COUNT ( Communication[Date Sent] ),
            FILTER (
                ALL ( Communication[Customer ID] , Communication[Date Sent]),
                Communication[Customer ID] = Sales[Customer ID] &&  Communication[Date Sent] <= Sales[Date])
            )
         > 0,
        TRUE (),
        FALSE ()
    )

     

    that will tell you if the com was sent prior to the purchase. You might want to refine this, though, as for example limiting the period you want to check or linking the com type to a specific product.

    Note that for Customer 3 there are 3 communications, spanning almost 3 years. So just checking if there's been com sent before the purchase is probably too generic

    See it all at work in the attached file.

     

     

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers