Forum Discussion

vanessafvg's avatar
vanessafvg
Community Champion
8 years ago
Solved

Calculated measure based on category

I have a measure that i want to use based on summing up the category

 

for example

 

flat type   cost   expected result

100          20       50

100         30       50

200        40      90

200       50     90  

300      60     60

 

 

 

i have hit a total blank this morning, if i want to sum the cost by flat type and store that in a separte column for each row, how do i do this?

  • Anonymous's avatar
    Anonymous
    8 years ago

    HI vanessafvg,

     

    Based on my understanding, you want to summary the total cost of the same type, right?

    If this is a case, you can refer to below formula:

    Calculate column:

    Result = SUMX(FILTER(ALL('sample 2'),[flat type]=EARLIER('sample 2'[flat type])),[cost])

    Measure:

    Result = SUMX(FILTER(ALL('sample 2'),[flat type]=MAX('sample 2'[flat type])),[cost])

     

     

    Regards,

    Xiaoxin Sheng

     

2 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      HI vanessafvg,

       

      Based on my understanding, you want to summary the total cost of the same type, right?

      If this is a case, you can refer to below formula:

      Calculate column:

      Result = SUMX(FILTER(ALL('sample 2'),[flat type]=EARLIER('sample 2'[flat type])),[cost])

      Measure:

      Result = SUMX(FILTER(ALL('sample 2'),[flat type]=MAX('sample 2'[flat type])),[cost])

       

       

      Regards,

      Xiaoxin Sheng