Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Check several rows with same ID

Hi folks,

 

I am quite new to PowerBI and currently wokring on the following topic:

 

I do have messages and message_threads, both are in one table. Messages can be either OUTBOUND (sent by company) or INBOUND (sent by customer). I now want to count the number of active threads, meaning the number of threads where at least one message was sent by the customer.

 

message-idthread-idmessage-type
11OUTBOUND
21OUTBOUND
32OUTBOUND
42INBOUND
52OUTBOUND
63OUTBOUND
73OUTBOUND
83

INBOUND

 

In this Case thread 2 and 3 are active threads (at least one message with type INBOUND). Thread 1 is not active.

 

The outcome I would expect would for example look like the following:

 

message-idthread-idmessage-typeactive
11OUTBOUNDfalse
21OUTBOUNDfalse
32OUTBOUNDtrue
42INBOUNDtrue
52OUTBOUNDtrue
63OUTBOUNDtrue
73OUTBOUNDtrue
83

INBOUND

true

 

Thanks a lot in advance 🙂

 

1 ACCEPTED SOLUTION

@tamerj1 

 

There's no need to use IF here since ISEMPTY is already a logical function. This is the same:

NOT ISEMPTY(
    FILTER(
        CALCULATETABLE(
            T,
            ALLEXCEPT(
                T,
                T[thread-id]
            )
        ),
        T[message-type] = "INBOUND"
    )
)

View solution in original post

5 REPLIES 5
lulubrinki1
New Member

Thank a lot @daXtreme @tamerj1 ,

I have to correct my initial table I posted. 

factMessages

Message-idThread-IDMessageAttrKey
111
2 2
323
424

 

dimMessageAttributes

MessageAttrKeyType...
1OUTBOUND 
2OUTBOUND 
3INBOUND 
4INBOUND 

 

daXtreme
Solution Sage
Solution Sage

// Let the table be T.

[# Active Threads] =
CALCULATE(
    DISTINCTCOUNT( T[thread-id] ),
    DISTINCT( T[thread-id] ),
    T[message-type] = "inbound",
    REMOVEFILTERS( T )
)
tamerj1
Super User
Super User

Hi @Anonymous 

please try

=
IF (
    ISEMPTY (
        FILTER (
            CALCULATETABLE ( TableName, ALLEXCEPT ( TableName, TableName[thread-id] ) ),
            TableName[message-type] = "INBOUND"
        )
    ),
    FALSE,
    TRUE
)

@tamerj1 

 

There's no need to use IF here since ISEMPTY is already a logical function. This is the same:

NOT ISEMPTY(
    FILTER(
        CALCULATETABLE(
            T,
            ALLEXCEPT(
                T,
                T[thread-id]
            )
        ),
        T[message-type] = "INBOUND"
    )
)

@daXtreme 

You are 100% correct. Thank you

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.