Forum Discussion
Using two filters with CALCULATE
- 9 years ago
Hi tvitte,
A Boolean expression used as a filter parameter in a CALCULATE function corresponds to an equivalent FILTER expression that operates on all the values of a column. So you may need to use ALL function within the FILTER expression in your scenario like below.
AMC grade weighted with filter function = ( CALCULATE ( SUM ( DONNEES[Niveau] ); LMC; DONNEES; METIERS; NOMS ) + 2 * CALCULATE ( SUM ( DONNEES[Niveau] ); FILTER ( ALL ( DONNEES[compétence] ); DONNEES[compétence] = 10 ) ) ) / ( CALCULATE ( SUM ( DONNEES[Niveau] ); ALL ( Noms ); Noms[trigramme] = "AMC" ) + 2 * CALCULATE ( SUM ( DONNEES[Niveau] ); FILTER ( ALL ( DONNEES[compétence] ); DONNEES[compétence] = 10 ); ALL ( noms ); Noms[trigramme] = "AMC" ) ) * 5Reference: http://sqlblog.com/blogs/marco_russo/archive/2010/01/03/how-calculate-works-in-dax.aspx
Regards
Hi tvitte,
A Boolean expression used as a filter parameter in a CALCULATE function corresponds to an equivalent FILTER expression that operates on all the values of a column. So you may need to use ALL function within the FILTER expression in your scenario like below.
AMC grade weighted with filter function =
(
CALCULATE ( SUM ( DONNEES[Niveau] ); LMC; DONNEES; METIERS; NOMS )
+ 2
* CALCULATE (
SUM ( DONNEES[Niveau] );
FILTER ( ALL ( DONNEES[compétence] ); DONNEES[compétence] = 10 )
)
)
/ (
CALCULATE ( SUM ( DONNEES[Niveau] ); ALL ( Noms ); Noms[trigramme] = "AMC" )
+ 2
* CALCULATE (
SUM ( DONNEES[Niveau] );
FILTER ( ALL ( DONNEES[compétence] ); DONNEES[compétence] = 10 );
ALL ( noms );
Noms[trigramme] = "AMC"
)
)
* 5Reference: http://sqlblog.com/blogs/marco_russo/archive/2010/01/03/how-calculate-works-in-dax.aspx
Regards
- tvitte9 years agoRegular Visitor
Thanks for your explanation. For the record I used the function switch to solve this problem before your answer.