Forum Discussion

edcdcpowerbi's avatar
edcdcpowerbi
Icon for Helper I rankHelper I
4 years ago
Solved

CALCULATE filtering table by conditional measure

I have two measures which calculate initial and final scores. 

I now wish to have a measure which has all the clients who finished with a higher final score. 

A bit lost on how to go about it, this is what i currently have which does not work. 

Would appreciate any help and advice

 

CALCULATE( COUNT( 'Client'[ID]) , [Final Score] > [Initial Score] )

  • Hi edcdcpowerbi ,

     

    Please try the following formula:

     

    Measure = 
    CALCULATE (
        DISTINCTCOUNT ( 'Client'[ID] ),
        FILTER ( ALLSELECTED ( Client[ID] ), [Final Score] > [Initial Score] )
    )

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

8 Replies

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi edcdcpowerbi ,

     

    Please try the following formula:

     

    Measure = 
    CALCULATE (
        DISTINCTCOUNT ( 'Client'[ID] ),
        FILTER ( ALLSELECTED ( Client[ID] ), [Final Score] > [Initial Score] )
    )

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • If you can share the details of Initial and Final Score will be better but you can try using the variable

     

     

    MEASURE=
    
    VAR x1=[Final Score]
    VAR x2=[Initial Score]
    RETURN
    CALCULATE( COUNT( 'Client'[ID]) , x1>x2 )

     

     

    • edcdcpowerbi's avatar
      edcdcpowerbi
      Icon for Helper I rankHelper I

      Thanks for the help. It brings up the same semantic error i was getting in my initial measure unfortunately. 

      • edcdcpowerbi's avatar
        edcdcpowerbi
        Icon for Helper I rankHelper I

        The initial measures are creates with this measure: 

         

        CALCULATE(SUM('Client')'[Total Score]),'Client[Stage] = "Final")

        CALCULATE(SUM('Client')'[Total Score]),'Client[Stage] = "Initial")