Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help with measure and allselectec

Hello,

 

If someone can help me with my report I would be very gratefull!

I'm looking to create a new measure with total of sales in a matrix filtered by context.

 

I start with my matrix filtered  :

 

ID          SALES

A           10

B            20

C           15

D           40

 

what I want is :

 

ID          SALES          TOTAL_OF_SALES

A           10                           85

B           20                           85

C           15                           85

D           40                           85

 

 

Il I create a measure like TOTAL_OF_SALES = CALCULATE(SUM('TABLE1'[SALES]) ; ALLSELECTED('TABLE2'[ID]) )

 

I have this result :

 

ID          SALES          TOTAL_OF_SALES

A           10                           85

X                                          85

B           20                           85

C           15                           85

Z                                          85

D           40                           85

Z4                                        85

Z6                                        85

 

Every ID even those which are out of context appear... someidea to avoid this? 

 

Thanks.

 

Jerome

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hello guys,

     

    I'm back with a solution...

     

    Just need to switch my measure to 

    TOTAL_OF_SALES = SUMX(VALUES('TABLE1'[ID2];CALCULATE(SUM('TABLE1'[SALES]) ; ALLSELECTED('TABLE2'[ID]) )

     

    And it works perfectly!

     

    sorry for the disturbance.

     

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello guys,

     

    I'm back with a solution...

     

    Just need to switch my measure to 

    TOTAL_OF_SALES = SUMX(VALUES('TABLE1'[ID2];CALCULATE(SUM('TABLE1'[SALES]) ; ALLSELECTED('TABLE2'[ID]) )

     

    And it works perfectly!

     

    sorry for the disturbance.