Forum Discussion
Multiple countifs DAX
- 4 years ago
Hi, Spartanos
Is your Routing-port the same value, or a different one? SELECTEDVALUE is placed in Measure. Whether your Routing-port is the same value or a different value, there is a solution.
Routing-port is the same value:
Column:
Count 1 = IF ( [TEX] = 2, CALCULATE ( COUNT ( 'Table'[Routing-port] ), FILTER ( 'Table', [TEX] = 2 && [invoice] = EARLIER ( 'Table'[invoice] ) ) ), BLANK () )Measure:
Measure = IF ( SELECTEDVALUE ( 'Table'[TEX] ) = 2, CALCULATE ( COUNT ( 'Table'[Routing-port] ), FILTER ( 'Table', [TEX] = 2 && [invoice] = SELECTEDVALUE ( 'Table'[invoice] ) ) ), BLANK () )Routing-port is a different value.
Column:
Count 2 = CALCULATE ( COUNT ( 'Table 2'[Routing-port] ), FILTER ( 'Table 2', [TEX] = 2 && [invoice] = EARLIER ( 'Table 2'[invoice] ) && [Routing-port] = EARLIER ( 'Table 2'[Routing-port] ) ) )Measure:
Measure2 = CALCULATE ( COUNT ( 'Table 2'[Routing-port] ), FILTER ( ALL ( 'Table 2' ), [TEX] = 2 && [invoice] = SELECTEDVALUE ( 'Table 2'[invoice] ) && [Routing-port] = SELECTEDVALUE ( 'Table 2'[Routing-port] ) ) )I hope you can get the results you want from it.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Am I correct that I have to put SELECTEDVALUE in this line of code:
var port = Selectedvalue(Data[Routing Port])
Hi, Spartanos
Is your Routing-port the same value, or a different one? SELECTEDVALUE is placed in Measure. Whether your Routing-port is the same value or a different value, there is a solution.
Routing-port is the same value:
Column:
Count 1 =
IF (
[TEX] = 2,
CALCULATE (
COUNT ( 'Table'[Routing-port] ),
FILTER ( 'Table', [TEX] = 2 && [invoice] = EARLIER ( 'Table'[invoice] ) )
),
BLANK ()
)
Measure:
Measure =
IF (
SELECTEDVALUE ( 'Table'[TEX] ) = 2,
CALCULATE (
COUNT ( 'Table'[Routing-port] ),
FILTER ( 'Table', [TEX] = 2 && [invoice] = SELECTEDVALUE ( 'Table'[invoice] ) )
),
BLANK ()
)
Routing-port is a different value.
Column:
Count 2 =
CALCULATE (
COUNT ( 'Table 2'[Routing-port] ),
FILTER (
'Table 2',
[TEX] = 2
&& [invoice] = EARLIER ( 'Table 2'[invoice] )
&& [Routing-port] = EARLIER ( 'Table 2'[Routing-port] )
)
)
Measure:
Measure2 =
CALCULATE (
COUNT ( 'Table 2'[Routing-port] ),
FILTER (
ALL ( 'Table 2' ),
[TEX] = 2
&& [invoice] = SELECTEDVALUE ( 'Table 2'[invoice] )
&& [Routing-port] = SELECTEDVALUE ( 'Table 2'[Routing-port] )
)
)
I hope you can get the results you want from it.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.