Forum Discussion

tvitte's avatar
tvitte
Regular Visitor
9 years ago
Solved

Using two filters with CALCULATE

Hi,   I have a database of knowledges for each employees. There are some "defined profiles" based on levels for each knowledges. I want to calculate the "grade" for each employee corresponding to...
  • v-ljerr-msft's avatar
    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"
                    )
        )
        * 5

    Reference: http://sqlblog.com/blogs/marco_russo/archive/2010/01/03/how-calculate-works-in-dax.aspx

     

    Regards