Forum Discussion

extjac's avatar
extjac
Icon for Advocate I rankAdvocate I
8 years ago
Solved

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.

 

 

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!

  • 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 another filter and arrow goes down

     

    If this sample pbix file helps let me know,

     

    Maria

1 Reply

  • MariaP's avatar
    MariaP
    Icon for Solution Supplier rankSolution 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 another filter and arrow goes down

     

    If this sample pbix file helps let me know,

     

    Maria