1

Below is my sample table and I'd like to write a Dax statement that returns the current count whenever I filter for Team A or B. Ideally, the current count per team would be on a card in power BI.

team yearmonth active_cnt
a 2023-06 10
a 2023-07 15
a 2023-08 30
b 2023-06 15
b 2023-07 25
b 2023-08 30

Below was my attempt but it returned a blank response:

CurrentCountPerTeam = 
SUMX(
FILTER(
    'Query1',
    'Query1'[yearmonth] = YEAR(TODAY()) * 100 + MONTH(TODAY())
),
'Query1'[active_cnt]
)

1 Answers1

1

I added a variable that stores the current year & month and then compare to the yearmonth column to pull the current year & month count for each Team

  CurrentCountPerTeam =
  VAR __CurrentYearMonth = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
  RETURN
  SUMX(
  FILTER(
  'Query1',
  'Query1'[yearmonth] = __CurrentYearMonth
   ),
  'Query1'[active_cnt]
   )