Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Need help: Matrix with two tables

Hello everybody!

I'm having trouble creating a matrix view using two different tables but with the same fields in the summary lines.

I have tables like these:

 

SALES:

SELLER IDSALE VALUE (R$)
120
130
150
250
240
250
3200
325
350

 

OVERTIMES:

SELLER IDOVERTIME (HOURS)
11
12
23
32
33
35

 

Both report different things, but share the same SELLER ID.

I would like to create a matrix to view both tables summarized, like this:

SELLER IDSUM OF SALE VALUE (R$)SUM OF OVERTIME (HOURS)
11003
21403
327510

 

However when I try to add values from a second table in the matrix, it looks like this:

SELLER IDSUM OF SALE VALUE (R$)SUM OF OVERTIME (HOURS)
110016
214016
327516

 

  • Anonymous,

     

    This can be achieved with a star schema. Create a SELLERS table using Power Query or DAX. Here's a DAX calculated table:

     

    SELLERS = 
    DISTINCT (
        UNION ( DISTINCT ( SALES[SELLER ID] ), DISTINCT ( OVERTIMES[SELLER ID] ) )
    )

     

    Create relationships:

     

     

    In the visual, use SELLERS[SELLER ID]:

     

     

2 Replies

  • Anonymous,

     

    This can be achieved with a star schema. Create a SELLERS table using Power Query or DAX. Here's a DAX calculated table:

     

    SELLERS = 
    DISTINCT (
        UNION ( DISTINCT ( SALES[SELLER ID] ), DISTINCT ( OVERTIMES[SELLER ID] ) )
    )

     

    Create relationships:

     

     

    In the visual, use SELLERS[SELLER ID]: