The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance 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 |
---|---|
27 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
31 | |
15 | |
12 | |
8 | |
7 |