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 All,
I have two Fact Tables Table A and Table B. I want to get distinct count metric from Column which is comoon from both tables. Currenlty, I'm using below code and it's taking Time. Please Suggest optimized way for calculating it
Example:
FactA[Column] & FactB[Column]:
Thanks,
Abhiram
Solved! Go to Solution.
@abhiram342 - Be easier to verify if had sample data or data set but maybe try:
DistinctCount =
COUNTROWS(
DISTINCT(
UNION(
SELECTCOLUMNS('FactA',"Column",[Column]),
SELECTCOLUMNS('FactB',"Column",[Column])
)
)
)
@abhiram342 , Try like
countx(distinct(union(all('FactA'[Column]),all('FactB'[Column]))),[Column])
or
countrows(distinct(union(all('FactA'[Column]),all('FactB'[Column]))))
[Distinct Count] =
COUNTROWS(
DISTINCT(
UNION(
VALUES( FactA[Column] ),
VALUES( FactB[Column] )
)
)
)
[Distinct Count] =
COUNTROWS(
DISTINCT(
UNION(
VALUES( FactA[Column] ),
VALUES( FactB[Column] )
)
)
)
@abhiram342 , Try like
countx(distinct(union(all('FactA'[Column]),all('FactB'[Column]))),[Column])
or
countrows(distinct(union(all('FactA'[Column]),all('FactB'[Column]))))
@abhiram342 - Be easier to verify if had sample data or data set but maybe try:
DistinctCount =
COUNTROWS(
DISTINCT(
UNION(
SELECTCOLUMNS('FactA',"Column",[Column]),
SELECTCOLUMNS('FactB',"Column",[Column])
)
)
)
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |