Forum Discussion
MCornish
Responsive Resident
6 years agoSum where exists in another table
Ok, its probably easier to show you what im trying to create rather than try explain it Date Promotion Value Order Value All Orders 01/01/2019 £ 952.00 £ 975....
- 6 years ago
Hi MCornish ,
Sorry for mu late respond, we can create a measure as below.
Measure = VAR linkcolumn = VALUES ( 'Table (2)'[LinkColumn] ) VAR ordernum = VALUES ( 'Table (2)'[OrderNum] ) RETURN IF ( ISFILTERED ( 'Table (2)'[PromoID] ), CALCULATE ( SUM ( 'Table'[LineCost] ), FILTER ( 'Table', 'Table'[LinkColumn] IN linkcolumn && 'Table'[OrderNum] IN ordernum ) ), BLANK () )
Pbix as attached as well. - 6 years ago
With a small tweak it does what I need.
Measure = VAR linkcolumn = VALUES ( 'Table (2)'[LinkColumn] ) VAR ordernum = VALUES ( 'Table (2)'[OrderNum] ) RETURN IF ( ISFILTERED ( 'Table (2)'[PromoID] ), CALCULATE ( SUM ( 'Table'[LineCost] ), FILTER ( 'Table', 'Table'[OrderNum] IN ordernum ) ), BLANK () )Basically I removed the
'Table'[LinkColumn] IN linkcolumn
from the SUM.
Cheers
v-frfei-msft
Community Support
6 years agoHi MCornish ,
Sorry for mu late respond, we can create a measure as below.
Measure =
VAR linkcolumn =
VALUES ( 'Table (2)'[LinkColumn] )
VAR ordernum =
VALUES ( 'Table (2)'[OrderNum] )
RETURN
IF (
ISFILTERED ( 'Table (2)'[PromoID] ),
CALCULATE (
SUM ( 'Table'[LineCost] ),
FILTER (
'Table',
'Table'[LinkColumn] IN linkcolumn
&& 'Table'[OrderNum] IN ordernum
)
),
BLANK ()
)
Pbix as attached as well.
MCornish
Responsive Resident
6 years ago
With a small tweak it does what I need.
Measure =
VAR linkcolumn =
VALUES ( 'Table (2)'[LinkColumn] )
VAR ordernum =
VALUES ( 'Table (2)'[OrderNum] )
RETURN
IF (
ISFILTERED ( 'Table (2)'[PromoID] ),
CALCULATE (
SUM ( 'Table'[LineCost] ),
FILTER (
'Table',
'Table'[OrderNum] IN ordernum
)
),
BLANK ()
)
Basically I removed the
'Table'[LinkColumn] IN linkcolumn
from the SUM.
Cheers