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.
I have a couple tables. FactTable1 is connected to all dimensions and FactTable2 has some preagregated data and has only one realtion to FactTable1 (many) <-FactTable2(one) using CompositeId.
Tables structure:
FactTable1 |
PrimaryId |
CompositeId |
.... |
Amount |
and
FactTable2 |
CompositeId |
DifferentAmount |
I would like to use FactTable1 distinct CompositeId values and get a sum of FactTable2[DifferentAmount].
My current code that doesn't work:
//Code works, but return bigger result that expected
//probably, because the calculation has duplications and adds the same value
//from FactTable2[DifferentAmount] several times
SUMX (
FactTable1,
RELATED (FactTable2[DifferentAmount])
)
//This code should remove duplicates, but it doesn't work
SUMX (
DISTINCT (FactTable1[CompositeId]),
RELATED (FactTable2[DifferentAmount])
)
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |