Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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-id | thread-id | message-type |
1 | 1 | OUTBOUND |
2 | 1 | OUTBOUND |
3 | 2 | OUTBOUND |
4 | 2 | INBOUND |
5 | 2 | OUTBOUND |
6 | 3 | OUTBOUND |
7 | 3 | OUTBOUND |
8 | 3 | 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-id | thread-id | message-type | active |
1 | 1 | OUTBOUND | false |
2 | 1 | OUTBOUND | false |
3 | 2 | OUTBOUND | true |
4 | 2 | INBOUND | true |
5 | 2 | OUTBOUND | true |
6 | 3 | OUTBOUND | true |
7 | 3 | OUTBOUND | true |
8 | 3 | INBOUND | true |
Thanks a lot in advance 🙂
Solved! Go to Solution.
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"
)
)
// Let the table be T.
[# Active Threads] =
CALCULATE(
DISTINCTCOUNT( T[thread-id] ),
DISTINCT( T[thread-id] ),
T[message-type] = "inbound",
REMOVEFILTERS( T )
)
Hi @lulubrinki
please try
=
IF (
ISEMPTY (
FILTER (
CALCULATETABLE ( TableName, ALLEXCEPT ( TableName, TableName[thread-id] ) ),
TableName[message-type] = "INBOUND"
)
),
FALSE,
TRUE
)
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"
)
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
21 | |
17 | |
16 | |
11 | |
7 |
User | Count |
---|---|
26 | |
25 | |
12 | |
12 | |
12 |