Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

DIVIDE using Filters

Hello,

 

Thank you to all who reply!

 

I am trying unsuccessfully to create a percentage for a card using one column "Country" and another column "Auto Trans".

 

The Country column contains United States or Canada. I would like to get take the sum total Auto Trans = Canada and divide by total sum Auto Trans = United States.

 

Any help is greatly appreciated.

BLD 

  • Anonymous add two measures

     

    Sum Measure = sum(vioUsCan[Auto Transmission]
    
    VIO Auto = 
    DIVIDE( 
        CALCULATE ( 
          [Sum Measure], 
          FILTER ( ALLSELECTED ( vioUsCan ), vioUsCan[Country] = "Canada" )
       ), 
       CALCULATE ( 
          [Sum Measure], 
          FILTER ( ALLSELECTED ( vioUsCan ), vioUsCan[Country] = "United State" )
       )
    )

     

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
    Here is my latest attempt:
     
    VIO Auto = DIVIDE(sum(vioUsCan[Auto Transmission]),(vioUsCan[Auto Transmission]), (FILTER(vioUsCan[Country] = "Canada"),FILTER(vioUsCan(vioUsCan[Country]= "United States"))
  • Anonymous add two measures

     

    Sum Measure = sum(vioUsCan[Auto Transmission]
    
    VIO Auto = 
    DIVIDE( 
        CALCULATE ( 
          [Sum Measure], 
          FILTER ( ALLSELECTED ( vioUsCan ), vioUsCan[Country] = "Canada" )
       ), 
       CALCULATE ( 
          [Sum Measure], 
          FILTER ( ALLSELECTED ( vioUsCan ), vioUsCan[Country] = "United State" )
       )
    )

     

     

    Follow us on LinkedIn and  to our YouTube channel

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Yes this will work. Thanks.