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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.