Join 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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I have this column in powerbi:
DiscussionEvents
1. Discussion Created
2. Discussion Reply Created
3. Discussion Updated
4. Discussion Viewed
I am trying to create a flag measure that returns me 1 if the count of "Discussion Created" and "Discussion Reply Created" is not zero and vice versa.
Could anyone help please.
Solved! Go to Solution.
Hi @sonaliverma ,
Please try the following formula:
Measure =
VAR count_created =
CALCULATE (
COUNT ( 'Table'[DiscussionEvents] ),
'Table'[DiscussionEvents] = "Discussion Created"
)
VAR count_reply =
CALCULATE (
COUNT ( 'Table'[DiscussionEvents] ),
'Table'[DiscussionEvents] = "Discussion Reply Created"
)
VAR flag =
IF ( count_created > 0 && count_reply > 0, "YES", "NO" )
RETURN
IF (
ISFILTERED ( 'Table'[DiscussionEvents] ),
COUNT ( 'Table'[DiscussionEvents] ),
flag
)
Then modify the total label: "Flag".
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello @nvprasad ,
Thank you for your response. Actually I am trying to build a Matrix with below columns:
DiscussionEvents
1. Discussion Created
2. Discussion Reply Created
3. Discussion Updated
4. Discussion Viewed
DiscussionID
1. 4256
2. 5619
3. 8916
etc. etc.
I am trying to create a pivot table like this:
DiscussionID Discussion Created Discussion Replied Flag
1234 1 NO
4567 2 1 YES
5678 6 4 YES
5691 1 NO
POV: Values in discussion created and discussion replied is the count(DiscussionEvents).
Hi @sonaliverma ,
Please try the following formula:
Measure =
VAR count_created =
CALCULATE (
COUNT ( 'Table'[DiscussionEvents] ),
'Table'[DiscussionEvents] = "Discussion Created"
)
VAR count_reply =
CALCULATE (
COUNT ( 'Table'[DiscussionEvents] ),
'Table'[DiscussionEvents] = "Discussion Reply Created"
)
VAR flag =
IF ( count_created > 0 && count_reply > 0, "YES", "NO" )
RETURN
IF (
ISFILTERED ( 'Table'[DiscussionEvents] ),
COUNT ( 'Table'[DiscussionEvents] ),
flag
)
Then modify the total label: "Flag".
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi sonaliverma,
Can you try below measure.
Check = if (CALCULATE(COUNTROWS(TABLE),TABLE[COLUMN]="Discussion Created" ||TABLE[COLUMN]="Discussion Reply Created")>0, "YES","NO")
Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂
Regards,
N V Durga Prasad
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!