Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi all,
I have this sample table:
I want to calculate the count of users, which have two different stores . I use direct query, so i can not use summerize or groub by.
I've tried this code but it needs a shot, which i can not find.
Count of users with two stores = CALCULATE(DISTINCTCOUNT('table'[UserId]);FILTER(ALLSELECTED(table'[UserId]);DISTINCTCOUNT('table'[Store])=2))Could someone help me please 🙂
Taher
Solved! Go to Solution.
Try this MEASURE
Measure =
COUNTROWS (
FILTER (
SUMMARIZE (
'Table',
'Table'[UserID],
"Count", DISTINCTCOUNT ( 'Table'[StoreID] )
),
[Count] = 2
)
)
Sorry I didn't read you can't use summarize
Try this
Measure 2 =
COUNTX (
FILTER (
ALL ( 'Table'[UserID] ),
CALCULATE ( DISTINCTCOUNT ( 'Table'[StoreID] ) ) = 2
),
CALCULATE ( DISTINCTCOUNT ( 'Table'[StoreID] ) )
)
Try this MEASURE
Measure =
COUNTROWS (
FILTER (
SUMMARIZE (
'Table',
'Table'[UserID],
"Count", DISTINCTCOUNT ( 'Table'[StoreID] )
),
[Count] = 2
)
)
Hi @Zubair_Muhammad,
thank u very much. You have really saved me with this measure 🙂
The measure with SUMMERIZE WORKED WELL ( I DONT KNOW HOW WITH DIRECT QUERY !!).
I'll try the second measure as well.
I'm very gratefull, thnx a lot 🙂
Taher
Sorry I didn't read you can't use summarize
Try this
Measure 2 =
COUNTX (
FILTER (
ALL ( 'Table'[UserID] ),
CALCULATE ( DISTINCTCOUNT ( 'Table'[StoreID] ) ) = 2
),
CALCULATE ( DISTINCTCOUNT ( 'Table'[StoreID] ) )
)
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 51 | |
| 40 | |
| 37 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 85 | |
| 69 | |
| 38 | |
| 29 | |
| 27 |