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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
extjac
Regular Visitor

Card vs Measure Year over Year

Hello, I have created a few measures to compare the number of incidents opened Year over Year.

 

 I created the following measures:

- YTD

- SamePeriodLastYear,

- SamePeriodTwoYearsAgo

 

I use a card visual to display the numbers/measures...but ....because I need to break it down by Region or Team or other critria I add "visual filters" to the cards. 

 

In my dashboard, I need to put a red or green arrows next to the visual card showing if the year over year numbers increase or decrese. 

 

So I was wondering....is there a way to write some logic where the "red" or "green" arrows will change acording the "value" of the card.

 

arrows.png

 

Lets say the  

Card YTD = 190

Card SamePeriodLastYear = 200

2017 | 2018 | Arrow

200 | 190 | green good

 

I would like to show green arrow showing the numbers are coming down; compared to last year.

 

Then, I might need to add a visual filter that might change the values. 

 

The new values will be:

YTD = 180

SamePeriodLastYear = 160

2017 | 2018 | Arrow

160 | 180 | red bad 

I would like to show red arrow because the numbers increased compared to last year.

 

It would amazing to be able to name the cards, then call them from DAX as Card1.value()....

 

but..since that does not exit i was wondering what would be the logic that can help me do this? 

 

thanks!

1 ACCEPTED SOLUTION
MariaP
Solution Supplier
Solution Supplier

Hi @extjac

 

With some fiddling with settings on cards and a table you could achieve results shown below.

 

Add 3 cards and one table for your arrows using this code (replace [MTC CY] with your [Current YTD] and

MTD PY with your [Preivous YTD] )

Arrows for MTD CY vs PY = SWITCH(
                          TRUE(),                         
                   'Sample'[MTD CY] <= [MTD PY], UNICHAR(128315),
                   'Sample'[MTD CY] > [MTD PY] ,UNICHAR(9650),
              BLANK()
             )

1. Add your PY value to the first Card w

2. Add your CY value  to next card

3. This is a Table formatted to look like a card (Make headers white, turn borders off and enlarge size of values.) - Add the arrow measure

4. Card with Arrow - Add the arrow code

 

With this you can see the RED arrrow an BLACK arrow in Card 3. I have managed to make the arrow GREEN only in 4. The table.

Select Filter and Arrow goes UPSelect Filter and Arrow goes UPSelect another filter and arrow goes downSelect another filter and arrow goes down

 

If this sample pbix file helps let me know,

 

Maria

View solution in original post

1 REPLY 1
MariaP
Solution Supplier
Solution Supplier

Hi @extjac

 

With some fiddling with settings on cards and a table you could achieve results shown below.

 

Add 3 cards and one table for your arrows using this code (replace [MTC CY] with your [Current YTD] and

MTD PY with your [Preivous YTD] )

Arrows for MTD CY vs PY = SWITCH(
                          TRUE(),                         
                   'Sample'[MTD CY] <= [MTD PY], UNICHAR(128315),
                   'Sample'[MTD CY] > [MTD PY] ,UNICHAR(9650),
              BLANK()
             )

1. Add your PY value to the first Card w

2. Add your CY value  to next card

3. This is a Table formatted to look like a card (Make headers white, turn borders off and enlarge size of values.) - Add the arrow measure

4. Card with Arrow - Add the arrow code

 

With this you can see the RED arrrow an BLACK arrow in Card 3. I have managed to make the arrow GREEN only in 4. The table.

Select Filter and Arrow goes UPSelect Filter and Arrow goes UPSelect another filter and arrow goes downSelect another filter and arrow goes down

 

If this sample pbix file helps let me know,

 

Maria

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.