Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi Everyone,
I'm trying to write a DAX expression in the pivot table and I could not figured out how to use the combination of Calculate, Filter & Count.
I need to exclude all User that has 1 or less transaction - I currently have this expression but the result is not correct:
=if(
count([Type]) > 1, COUNT([Type]),
blank())
The Data is as follows:
Department | User | Symbol | Type |
A1 | AAA | TSLA | Buy |
A1 | AAA | TSLA | Buy |
A1 | CCC | BCE | Buy |
A1 | DDD | PWC | Buy |
B1 | AAA | HBT | Sell |
B1 | BBB | BCE | Buy |
B1 | BBB | HDS | Sell |
Output should be, note User "CCC" & "DDD" are not populated because it has only 1 count:
Department | User | Type | Symbol | Count |
A1 | AAA | Buy | TSLA | 2 |
Sell | HBT | 1 | ||
B1 | BBB | Buy | BCE | 1 |
Sell | HDS | 1 |
Hope you can help!
[Exclude User] =
var __userFiltered = ISFILTERED( Data[User] )
var __oneUserVisible = HASONEVALUE( Data[User] )
var __totalTranCount =
CALCULATE(
COUNTROWS( Data ),
ALLEXCEPT( Data, Data[User] )
)
var __shouldExclude = __totalTranCount <= 1
var __finalCondition =
__userFiltered
&& __oneUserVisible
&& __shouldExclude
return
if( __finalCondition, __shouldExclude )
This measure tells you if you should exclude the user (TRUE) or not (FALSE). You can put this measure in your pivot and filter by it leaving only those users for which the measure returns FALSE (meaning: don't exclude).
Best
D
Maybe:
Measure =
VAR __Table =
SELECTCOLUMNS(
FILTER(
SUMMARIZE(
ALL('Table'),
[User],
"__Count',COUNTROWS('Table')
),
[__Count] < 2
),
"User",
[User]
)
RETURN
IF(MAX('Table'[User] IN __Table,0,1)
Then use that as a filter.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |