Forum Discussion

WeihsMichael's avatar
WeihsMichael
New Member
4 years ago
Solved

sum column A based on values in column B

Last column (3.754.621) should only total up values if column before (3.400.580) contains values (so the last 3 rows should not be part of the total, currently they are). Both data fields are within the same table.

 

If you have suggestions, they are more than welcome.

 

Thx, Michael

  • WeihsMichael  you can write a measure like this

    _val2 = CALCULATE(SUM(t2[val2]),FILTER(t2,t2[val1]<>BLANK()))

     

     

17 Replies

  • smpa01's avatar
    smpa01
    Icon for Community Champion rankCommunity Champion

    WeihsMichael  you can write a measure like this

    _val2 = CALCULATE(SUM(t2[val2]),FILTER(t2,t2[val1]<>BLANK()))

     

     

  • Samarth_18's avatar
    Samarth_18
    Icon for Community Champion rankCommunity Champion

    Hi WeihsMichael ,

     

    You can create a new column with below code and use it instead:-

    column = if(column B <> blank(),column A)

     

    Thanks,

    Samarth

     

    • WeihsMichael's avatar
      WeihsMichael
      New Member

      Hi Samarth, thanks for posting the DAX line, it almost worked except for the total remaining unchanged. Maybe you have a clue?

       

      Column C = IF('ZV Vertrieb'[Aboumsatz] <> BLANK(),'ZV Vertrieb'[Aboumsatz VJ],'ZV Vertrieb'[Aboumsatz])
      • Samarth_18's avatar
        Samarth_18
        Icon for Community Champion rankCommunity Champion

        WeihsMichael , Based on the condition which you have mentioned. Below code would be ideal:-

        Column C = IF('ZV Vertrieb'[Aboumsatz] <> BLANK(),'ZV Vertrieb'[Aboumsatz VJ])