Forum Discussion

chrisgehm's avatar
chrisgehm
Helper III
8 years ago
Solved

Operate with 2 cards

Hi everyone!

 

I'm having troubles while operating with 2 cards.

 

Both of them have filters and I have a numer from each card.

Is there any way to make arithmetic operations between both cards?

 

Example:

Card1

100

 

Card2

75

 

What I need:

100/75 = 1.33

 

Kind regards!

  • Hey,

     

    try this

    the measure = 
    DIVIDE(
      CALCULATE(
        ,COUNTROWS('yourtable')
        ,'yourtable'[colorcolumn] = "red"
      )
      ,CALCULATE(
        ,COUNTROWS('yourtable')
        ,'yourtable'[colorcolumn] = "blue"
      )
    )

    Regards

    Tom

8 Replies

  • Hey,

     

    unfortunately you cant't reference values from a visual (your card(s)) to calculate a new value.

     

    For this reason you have create a measure that rebuilds the filter from the separate card visuals, something like this

    3rd measure =
    DIVIDE(
      CALCULATE(
        SUM('table'[column])
        ,'table'[filtercolumn2] = "this" &&
        ,,'table'[filtercolumn1] IN {"red", "blue"}
      )
      ,CALCULATE(
        SUM('table'[column])
        ,'table'[filtercolumn2] = "this"
      )
    )

    Hope this gets you started

     

    Regards

    Tom

     

    • chrisgehm's avatar
      chrisgehm
      Helper III

      Hi TomMartens thanks for the answer.

      Actually what I need is to divide the COUNT of 2 things.


      Example:

      I've got 100 values with color red. It does not matter what is the value. It could be A, B, C, anyone.

      And I've got 75 values with clor blue and yellow. Same conditions, it does not matter the value, what I need is to know how many there are.

       

      After that, I need to make the division of that 2 COUNTS.

       

      Is it possible?

       

      Sorry for my bad English.


      Kind regards.

      • TomMartens's avatar
        TomMartens
        Super User

        Hey,

         

        try this

        the measure = 
        DIVIDE(
          CALCULATE(
            ,COUNTROWS('yourtable')
            ,'yourtable'[colorcolumn] = "red"
          )
          ,CALCULATE(
            ,COUNTROWS('yourtable')
            ,'yourtable'[colorcolumn] = "blue"
          )
        )

        Regards

        Tom