The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |