Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi all. I can not seem to figure out the filter context and calculated column will not give me the expected results.
The measure is the following:
Teams Channels =
@Anonymous Can you please attach sample dataset?
Hi, @Anonymous , with regard to this part of the measure in question,
VAR amount_per_user =
CALCULATE (
SUM ( 'Teams statistics'[Team Chat Message Count] ),
FILTER (
'Teams statistics',
'Teams statistics'[User Principal Name] = current_user
)
)
'Teams statistics' is already filtered in the initial filter context (row from table/matrix, selection of slicer, interaction from other viz, etc.) before it's further filtered by FILTER().
I assume that you tend to filter the whole 'Teams statistics' table with condition 'Teams statistics'[User Principal Name] = current_user; if so, this variable can be simplified this way,
VAR amount_per_user =
CALCULATE (
SUM ( 'Teams statistics'[Team Chat Message Count] ),
'Teams statistics'[User Principal Name] = current_user
)
This classic article by Jeffrey Wang unveiled some sophisticated details of mechanism of filter context. I strongly recommend it if you'd like to dig deeper into filter context in DAX. Enjoy!
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Thanks, @CNENFRNL
Your example is bit closer to what I want but still not ideal.
Now one user gives me wrong result and somehow I think I need to take period into the account? The example shows where 2 is shown as "Yes" which is great and bottom one is wrong. I am also filtering the visual itself by week offset (taking only last 4 weeks) . The difference between these users is:
@CNENFRNL , also Teams Channels is calculated column I am trying to create as later I will have to count "Yes'es". Could it be the problem ?
@Anonymous Is 'Teams statistics'[User Principal Name] a measure or a refrence to a column or you didn't wrap inside SELECTEDVALUE?
Try this:
Teams Channels =
VAR current_user = 'Teams statistics'[User Principal Name]
VAR amount_per_user =
CALCULATE (
SUM ( 'Teams statistics'[Team Chat Message Count] ),
'Teams statistics'[User Principal Name] = current_user,
REMOVEFILTERS ( 'Teams statistics' )
)
RETURN
IF ( amount_per_user >= 2, "Yes", "No" )
Thank you and apologies, this is not the measure but calculated column I am trying to get as eventually I will have to count "Yes'es" and not sure if masure will serve this purpose...?
'Teams statistics'[User Principal Name] is a column, and I di not wrap it in VALUES.
I am afraid your suggestion still gives me same result 😞
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
6 | |
4 | |
3 | |
3 |
User | Count |
---|---|
11 | |
11 | |
8 | |
8 | |
8 |