Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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]
)
Solved! Go to Solution.
Solution. Thank you all.
CurrentCountPerTeam =
VAR __CurrentYearMonth = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
RETURN
SUMX(
FILTER(
'Query1',
'Query1'[cyearmonth] = __CurrentYearMonth
),
'Query1'[active_cnt]
)
@SammuelM what is not working when you add the measure that I provided in the most recent reply? if it is not working, share your pbix file with the expected output. It is very hard to work on the replies without understanding the data.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@SammuelM I see, you are formatting it as YYYY-MM, which is fine. I'm still not sure what you are looking for but try this:
CurrentCountPerTeam =
SUMX(
FILTER(
'Query1',
'Query1'[yearmonth] = TODAY ()
),
'Query1'[active_cnt]
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
So, I want to create a calculation that shows the latest count per team when I filter for the that Team. So if I filter for Team A, I'd liker to see hte count for the current month and year.
@SammuelM seems like yearmonth column in your table is stored as a text, if that is the case then do this:
CurrentCountPerTeam =
VAR __Current = FORMAT ( TODAY (), "YYYY-MM" )
RETURN
SUMX(
FILTER(
'Query1',
'Query1'[yearmonth] = __Current
),
'Query1'[active_cnt]
)
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
It's actually a year-month date.
Try this to see how it is.
RecuentoActualPorEquipo =
CALCULATE(
SUM('Consulta1'[active_cnt]),
FILTER(
'Consulta1',
'Consulta1'[Equipo] = "a" || 'Consulta1'[Equipo] = "b"
),
LASTNONBLANK('Consulta1'[añomes], 1)
)
Solution. Thank you all.
CurrentCountPerTeam =
VAR __CurrentYearMonth = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)
RETURN
SUMX(
FILTER(
'Query1',
'Query1'[cyearmonth] = __CurrentYearMonth
),
'Query1'[active_cnt]
)
CurrentCountPerTeam =
SUM('Query1'[active_cnt]),
FILTER(
'Query1',
'Query1'[team] = "a" || 'Query1'[team ] = "b"
),
LASTNONBLANK('Query1'[yearmonth], 1)
)
Thank you. But I have multiples teams(roughly 40). How do I account for all 40 instead of just 'a' & 'b'. The data you in my original post was just a sample
@SammuelM what do you define as a current?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k The latest month would be current. So if there was a september entry then once I filter for a particular team I should see the count for that team for the current year & month
User | Count |
---|---|
77 | |
75 | |
46 | |
31 | |
28 |
User | Count |
---|---|
99 | |
93 | |
50 | |
49 | |
46 |