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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
StuartSmith
Power Participant
Power Participant

Calculate difference between 2 filtered cards and show result on 3rd card.

I have a table that has number of tickets dealt with an employee

 

2020-05-18_11-23-17.png

 

I then have 2 filtered (2019/2020) card visuals showing show the number of tickets for 2019/2020.

 

2020-05-18_11-25-50.png

I then want to have a 3rd card showing the differecne between the 2019 & 2020 values. Is this possible?

 

 

11 REPLIES 11
Syndicate_Admin
Administrator
Administrator

Same problem. How to do operations between cards and that the result changes depending on filtered in the visualization. It's possible??

amitchandak
Super User
Super User

@StuartSmith , find this year vs last year using date calendar and take there diff, using card it is not possible to have diff

This Year = TOTALYTD(Sum('order'[Date]),'Date'[Date])
Last Year = TOTALYTD(Sum('order'[Date]),dateadd('Date'[Date],-1,year))


This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))

 

diff = [This Year] -[Last Year]

 

 

az38
Community Champion
Community Champion

@StuartSmith 

create a measure

= CALCULATE(COUNTROWS(Table), Table[Year]=2020) - CALCULATE(COUNTROWS(Table), Table[Year]=2019) 

and put it on the card


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Could you help me? I try to do the same thing, but i cant. image.png

Thanks for a quick response.  As some of the rows will contain "0" and some will contain more than "1!, the "CountRows" function gives an incorrect values (see below). I guess it needs to be a SUM measure to count the sum of the rows that meet the criteria of 2019 or 2020

 

2020-05-18_12-01-37.png

 

 

 

image.png

Hi! I have the same question like you, but i cant solve my problem. Could you help me? 

Figured it out...

 

Ticket Difference = CALCULATE(SUM('All Tickets'[Tickets]), 'All Tickets'[Year] = 2020) - CALCULATE(SUM('All Tickets'[Tickets]), 'All Tickets'[Year] = 2019)
 
2020-05-18_12-40-52.png
 
now is there a way to format the text for "Green" for a positive number & "Red" for a negative number?
 
 

Back again, and also figured out the conditional formattion...

2020-05-18_12-51-42.png

 

But noticed that the card will only go down to -433 and then wont change!  any ideas?

 

@az38 & @amitchandak Thanks for you help and I have now got the result I wanted. 👍

az38
Community Champion
Community Champion

@StuartSmith 

create a measure

Color = IF([Ticket Difference] > 0, "Green", "Red")

go to visual settings, data label and press Fx button. Choose Format by field value and select new Colour Measure


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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