How to choose any column and sum up the values?

Hi everyone.

I’d like to this but have difficulties to work out ;

Table1
Date A B C
*** 1 2 3
*** 1 2 3
*** 1 2 3

Action

  1. Choose A, B or C by dropdown (completed)

  2. Choose start date and end date (completed)

3 Sum up the chosen item ex. When I choose A, the answer is 3 ( When B, 6)

I already know SELECT(Table1[A], AND([Date] >= [_THISROW].[start].[Date] <= [_THISROW].[end])) and have searched many articles but no fruits.

If you give me a breakthrough, very helpful.

SUM(SELECT(table1[A],and([date]>=[_thisrow].[start_date],[date]<=[_thisrow].[end_date])))

Column A from Table 1 must be number or price type column

Thank you for your comment.

Yes, I have set the type as number.

Like this:

SUM(
  SWITCH(
    [Choose A, B, or C],
    "A",
      SELECT(
        Table1[A],
        AND(
          ([Date] >= [_THISROW].[Start Date]),
          ([Date] <= [_THISROW].[End Date])
        )
      ),
    "B",
      SELECT(
        Table1[B],
        AND(
          ([Date] >= [_THISROW].[Start Date]),
          ([Date] <= [_THISROW].[End Date])
        )
      ),
    ...,
    LIST()
  )
)

See also:

3 Likes

HI Steve!

Done and worked it out!!
I greatly appreciate your help,

And I always refer your articles or comments, really helpful, thank you!

2 Likes