Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
chrisgehm
Helper III
Helper III

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!

1 ACCEPTED SOLUTION

Hey,

 

try this

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

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

8 REPLIES 8
TomMartens
Super User
Super User

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

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.

Hey,

 

try this

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

Regards

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

@TomMartens Do you know why I'm getting this error?

dave24meyers_0-1635427475436.png

 

Hi Tom

 

Thanks for this. I've spent too long trying to get this result until I found your messaure!

 

One thing, for me the mesaure only worked when I took out the commas (in Red below): 

 

the measure =
DIVIDE(
CALCULATE(
,COUNTROWS('Table20')
,'Table20'[Status Fixed] = "Disengaged"
)
,CALCULATE(
COUNTROWS('Schedule20')
,'Table20'[Status Fixed] <> BLANK()
)
)*100

 

Any thoughts why this might be? 

 

Thanks 

Duncan

Hi @TomMartens  thank you for your answer, but what happens if red and blue values are not fixed, but ther are selected in two different selection box?

 

Is any option to do the same dinamically?

 

Thank you

Hi Tom

 

Any chance you could help me with the syntax for the following pseudo measure code (only an example as the actual data is sensitive):

 

DIVIDE(

   CALCULATE(

       ,COUNTROWS(UNIQUE('table'[field3]))
       ,'table'[field1] <= 17

       ,'table'[field2] = "name"

   )

   CALCULATE(

       ,COUNTROWS('table')

       ,'table'[field2] = "name"

   )

)

 

Essentially I want to count the number of unique values in field3 where field1 is less than or equal to 17 and field2 is "name" and divide that result by the count of the number of unique values in field3 where field2 is "name".

 

I currently have both those values in cards on my visualisation, but cannot seem to get the percentage of result 1 / result 2.

 

Hope that makes sense.

 

Much appreciated,

R. 

Thanks!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.