Forum Discussion

goalie_'s avatar
goalie_
Icon for Helper III rankHelper III
5 years ago
Solved

Getting the sum after an average measure

How would I create a measure for a "Quantity" that takes the sum between selected "Description" selected after it takes the average between "Spec" for a given ID? 

 

I'd like to have a table that looks like if mat1 and mat2 are selected in a slicer, I'd want a table visual that looks like

IDquantity
A0.53
B0.58
C0.33

 

or if mat5 or mat6 are selected

IDquantity
A0.18
B0.12
C0

 

My data is structured as below:

RequestID description   quantity
1Amat10.1
1Amat20.43
1Amat30.21
1Amat40.08
1Amat50.12
1Amat60.06
1Bmat10.25
1Bmat20.33
1Bmat30.2
1Bmat40.1
1Bmat50.12
1Cmat10.26
1Cmat20.07
1Cmat30.63
1Cmat40.04
2Amat10.1
2Amat20.43
2Amat30.21
2Amat40.08
2Amat50.12
2Amat60.06
2Bmat10.25
2Bmat20.33
2Bmat30.2
2Bmat40.1
2Bmat50.12
2Cmat10.26
2Cmat20.07
2Cmat30.63
2Cmat40.04

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi goalie_ 

     

    While mat5 or mat6 are selected, ID B only has mat5, but you need to divide 2 (mat5 or mat6)? I am using a connected dim table called slicerD which only conatins description

    sum of quantity = COALESCE(DIVIDE( SUM(yourTable[quantity]),COUNTROWS(VALUES(slicerD[description])),0),0)
    • goalie_'s avatar
      goalie_
      Icon for Helper III rankHelper III

      What do you mean by a connected dimtable? And yes ID B is only meant to contain upto mat5. For a given ID, the number of mats are not always identical. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi goalie_ 

         

        I mean the column in Slicer is not in the same table, but another connected one. The logic how you calculate affects the way you write your measure