Forum Discussion

mikelimas's avatar
mikelimas
Regular Visitor
8 years ago
Solved

How to Visualize Account Activity by Attributes that change over time

I have regular monthly data like sales, number of licenses, and other account related information that I would like to relate against the attributes of accounts that change over time.  That is, I have a table sales activity for accounts and I also have a table of accounts and their attributes.  These attributes can change over time (month to month for example), so I would like to be able to relate the invoicing to the attributes that were in effect at that time, not just the most recent set of attributes I have.  

 

If I have a table that has the sales in it like this:

 

Date | Acct ID | Sales

5-Dec-2017 | 123456 | $10,000.00

8-Jan-2018 | 123456 | $10,500.00

12-Feb-2018 | 123456 | $10,750.00

 

and another table that includes Acct Attributes that can change each month like this:

 

Acct Date | Acct ID | Locations | Licenses | Segment

31-Dec-2017 | 123456 | 4 | 22 | Green

31-Jan-2017 | 123456 | 4 | 28 | Green

28-Feb-2017 | 123456 | 5 | 31 | Gold

 

I'd like to be able to build report that would be able to show something like:

 

Sales by Segment for Dec through Feb: 

 

Segment | Sales

Green | $20,500

Gold | $10,750

 

To date, I have been indexing the attributes I want to report by into each row of activity data before I bring it into my BI data and I have to believe there is a better way to do this.  I'd love some suggestions!

 

  • mikelimas,

     

    You may refer to the following DAX that adds a calculated column.

    Column =
    MAXX (
        TOPN (
            1,
            FILTER (
                Table2,
                Table2[Acct ID] = Table1[Acct ID]
                    && Table2[Acct Date] > Table1[Date]
            ),
            Table2[Acct Date], ASC
        ),
        Table2[Segment]
    )
    

1 Reply

  • v-chuncz-msft's avatar
    v-chuncz-msft
    Community Support

    mikelimas,

     

    You may refer to the following DAX that adds a calculated column.

    Column =
    MAXX (
        TOPN (
            1,
            FILTER (
                Table2,
                Table2[Acct ID] = Table1[Acct ID]
                    && Table2[Acct Date] > Table1[Date]
            ),
            Table2[Acct Date], ASC
        ),
        Table2[Segment]
    )