Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Instructor: One of Power BI's biggest
and arguably most impactful updates of 2023
was the new card visual.
Now, the new card was introduced in preview in June 2023,
and the release was pretty big.
It gave you the ability to add
and format multiple fields within a single card visual
so that you could turn individual cards like this
into a single native visual like this.
It also added some brand new functionality like tool tips
and drill throughs along with new styling
and layout options, plus the addition of things like images
and accent bars.
So that was pretty great.
But in the November 2023 update,
they added some brand new functionality to these new cards,
specifically reference labels.
So reference labels allow you to build cards like this,
which can include additional metrics
like last month, forecast, et cetera.
You can add detail text to call out things like percent
or volume change
and add conditional formatting to draw attention to positive
or negative trends.
So in this demo, I'm gonna show you
how you can make the most of these new card visuals
and as a bonus, I'll also show you
how to use scalable vector graphics, or SVGs,
with custom embedded visuals like this sparkline here.
So here we're looking at our AdventureWorks report,
and you remember with these cards at the top
of our exec dashboard, we kind of had to do this manually.
We added four separate card visuals.
We added shapes for the background,
we grouped it all together.
So the first thing I wanna show you
is how the new card visual
can really help replicate something like this.
So I'm gonna add a new tab here.
I'm gonna call it New Card Demo.
And let's go ahead and insert a new card visual.
It looks just like the old card visual,
except has a lightning bolt in preview mode.
If you don't see this, head to your options.
Make sure to check that box in the preview settings
for the new card visual.
So go ahead and drop that onto the canvas,
stretch it out a little bit.
In this case, we're just gonna drop the fields
that we need into the data pane.
And let's go ahead
and just replicate what we had in that exec dashboard view.
So we had total revenue, we had total profits,
we had total orders,
and we had return rates.
And check it out.
Already we've got all four
of those metrics contained within one single visual
instead of four.
Now let's talk about
how we can start formatting this visual.
I'm gonna fire up my formatting pane here
and we're gonna go through all of these different options.
Don't really need to do anything with size and style,
don't need a visual level title.
We're gonna go into shape.
One thing I do like to do for a lot
of my cards is use the rounded rectangle
and I like to do something like a 10% rounded corner.
I think that looks pretty nice.
And if we go to layout, we can change things like alignment
and we can add a little bit of buffer
or space between the cards.
In this case, let's go ahead with a 20 pixel buffer.
Next up, we can drill into our callout values
and actually change the formatting of these numbers.
And with most of these formatting menus,
you'll have the option to apply universal changes to all
of the series, or you can make specific changes
to individual series.
So there are a few updates that I wanna make
to everything like the font.
Let's go Segoe UI, do size 40 in bold
and we're gonna use my favorite blue.
And yes, I have memorized the hex code.
It's 20E2D7 like so.
And by default, let's show one decimal place.
So that looks pretty good.
Suppose I wanted a second decimal place
for a metric like return rate.
In that case, I would scroll up,
select that specific series, and then go back down
and add the second decimal just to that field.
We can also edit the labels as well.
So let's go ahead back to all series,
drill into our label formatting options.
Let's go Segoe UI, maybe 11 points.
And I'm gonna make these white
'cause I'm gonna do a dark gray fill
in the background of these cards.
You can change the position as well.
You can do text wrap, all sorts of stuff there.
But that's all I need to do as far
as callout value formatting is concerned.
Now we're gonna skip over reference labels.
We're gonna talk about that in a bit.
We'll add images in just a bit as well.
But the card option, this is where I can apply some kind
of general styling to each of these four cards.
So you can do custom padding or default.
You can add or modify the background.
In this case, I like a nice dark gray background.
And then you've got some other features here.
Don't really need a border if we've got the background fill.
You can do crazy things with shadows or glows.
Don't really need to deal with that right now.
But I do like the accent bar here.
So you can do the accent bar on the left,
top, bottom, or right.
Let's give it that bright blue color.
In this case, you can see it pop in the left.
I'm just gonna add a little bit of width here, maybe four
or five pixels, something kind of subtle like so.
Now, last thing I wanna do is add some small images
or icons so I can head into images, which is a new feature
of these new cards and I can apply some universal settings
to how I wanna handle these images.
Let's go ahead and activate it.
And by default, let's put these to the left
of our label text here.
We'll put six pixels of space,
and I want my images to be pretty small, about 30 pixels.
This is probably one of those things
that's gonna take some trial and error
depending on the image sizes that you're using.
But I know that 30 works pretty well for mine.
So once we've got those universal settings,
I can drill into each individual setting
and I can browse for an image file.
So here's a revenue icon in white
with a transparent background.
That looks pretty good.
Go into profit, browse for that icon,
head into orders.
There we go.
And finally, return rates.
So there you have it.
So much simpler to be working with one single visual
that captures all four of these metrics.
So that's level one stuff.
Now let's take it up a notch to level two
and start seeing
how these brand new reference labels actually work.
So to do that, I'm gonna copy
and paste that card visual we just created.
And instead of going through the same process for all four
of these metrics, I'm gonna simplify things for the demo
and just focus on one for now.
So just revenue
and let's resize things a little bit like so.
And basically, what I wanna do here
is recreate something like we had here
in our executive dashboard with our revenue order
and return KPI cards, which remember,
instead of showing the kind of top line aggregate totals,
in this case, we're looking at the current month
and comparing it against the previous month
with a percent change.
So let's jump back in.
First thing I'm gonna do is change the filter context here
so that we're only looking at the current month of data.
Let's go ahead and drill into our filter pane.
And we're gonna need that start of month field.
I'm gonna add a visual level filter with a top N,
we're gonna show the top one month
based on the latest month.
That's gonna give me a total revenue of 1.8.
If we go back into formatting, callout values,
we can add a second decimal place.
Now, when you're dealing with reference labels,
the rounded rectangle style doesn't really work so well.
So let's go back into our options here, go into shape,
and I'm gonna change this back to a standard rectangle.
And now let's talk about what these reference labels
are all about.
First things first, I'm gonna add some universal formats
and we're gonna turn on things like a divider line.
That's gonna create a visual separation between my KPI value
and the reference labels beneath it.
Let's make that a bright blue with a width of two
and the background fill where our reference labels will be,
I want that to be just kind of a standard white,
and it's kind of tough.
I can't see what's changing
because I don't have any reference labels yet.
But as soon as I add one, you'll see what those formats
that it just applied actually look like.
So let's select a series, total revenue,
and let's add a label.
So what measure can we pull in that we want to display here
that would give us some helpful context
around this month's revenue?
Well, maybe the previous month's revenue.
Let's go ahead and select that and boom, it's dropped it in.
Now what I love about this
is that we can format every single component of this.
So we can select that label, previous month revenue,
we can customize the title.
Let's make it a little bit simpler, last month.
And we can also format just the value component
of that label as well in here.
Can make it bold, for instance.
And instead of choosing auto display units,
which rolled it up to the 2M that we see here,
can choose none and show the actual entire value.
Now, we can go ahead and add additional fields here as well.
So we can add a second label.
This time, maybe we want something like the revenue target
that adds another line right beneath our old label.
And again, we could do some formatting here.
For the new label revenue target, let's do custom
just call it Target.
And for the value, same story here, we can make it bold
and no display units.
So now we can see that our current month revenue is 1.83.
Last month, we were about 1.77.
Our target was 1.945.
We can add one more layer
of detail here using the detail option that we can assign
to any individual label.
So right now, we're looking at the revenue target label
and what kind of additional detail could we provide
around that target?
If you remember, we had a measure
that was called Revenue Target Gap.
Essentially, the difference
between current month revenue and the target.
So if we select that as our detail,
now we can see that our target was 1.945 million
and we fell short by about 118,000, but we're not done.
One thing that I love is that there are so many places
you can apply conditional formatting.
Any time you see that FX icon,
it means that you can get a little bit more fancy
and conditionally format things like fonts or fills
or background colors, even accent bars.
So in this case, let's add some conditional formatting
to the color of the font for that detail here.
And what we're gonna do is a rule-based format
and basically say, hey,
if that revenue target gap is negative, right?
If it's greater than or equal to the minimum value
and less than zero, right?
If it's a negative value, let's show that with a red font.
Otherwise, if it's greater than or equal to zero
and less than or equal to the maximum value, then you know,
maybe we choose a green here
or maybe we just show it with a dark gray.
Press OK.
And now check it out.
That gap figure changed to red
because our current month revenue fell short of the target.
Pretty amazing stuff that we're able
to produce in really just the matter of a few minutes.
But if you wanna get even fancier,
if you wanna get even more advanced,
the first thing I wanna show you
is how we can take these detail labels
and add things like icons or graphics using DAX measures
and UNICHAR functions.
So check this out, I'm gonna head to my data view.
And remember, we've got that revenue target gap measure.
I'm gonna add a new measure here,
and I'm gonna call this revenue target gap with arrow,
and I'm gonna paste some code here
and then explain it so that you don't have
to see me type it all out bit by bit.
So what we see here is initially,
we're creating three variables,
an uparrow, a downarrow, and revenuegap.
Now uparrow and downarrow
are both defined using the UNICHAR function,
which pulls in a UNICHAR code like the ones
that you see here, and essentially embeds an icon
and treats it like a character that you can concatenate
with other measures or other text strings.
Now, you can look up UNICHAR tables to figure out
how to find these codes for different symbols or icons,
but I'm using code for an uparrow that I like,
which is 129129,
and a basic downarrow, which is 129131.
And our revenuegap variable
is just our revenue target gap measure.
Now, in the return component of our measure,
we can add some conditional logic
and basically just say if that revenuegap is negative,
if we fell short of our target,
then I want to return the revenuegap value
with a space and the downarrow.
Otherwise show me the revenuegap with an uparrow.
Because we're concatenating text and characters here,
this measure will be formatted as a string.
So to preserve the currency format that I want,
what I'm doing is rounding the result of that measure
to zero places, and then I'm wrapping that
in a format function to display it as a currency format.
So let's go ahead and save that new measure.
And now all we need to do is go back to our visual,
head to the formatting pane, go back to reference labels,
all the way down to detail.
And now instead of revenue target gap,
we're gonna use revenue target gap with arrows
and check it out.
We get that same value, 118,000
with that UNICHAR down arrow as well.
Now you might be saying, all right, Chris, that's cool,
but what about those awesome sparklines that we could add
with the native KPI cards?
How could we do something like that?
Well, you can do that with SVGs.
Those are scalable vector graphics.
And there are a few things
that are really awesome about SVGs.
Number one, you can resize them to any size
or dimensions without losing quality.
They're supported by virtually every single browser.
And the best part, you can use XML code
to define different elements of an SVG, like the color,
shape, size, position, and more.
So our goal here is to use a custom SVG
to embed a sparkline similar to those existing KPI cards,
but much, much cooler.
So let's go ahead and start by copying
and pasting this existing visual.
And similar story here.
I'm just gonna demo with the revenue field.
I don't need to do this four separate times.
And drag it over here like so.
Now, if you're really skilled with XML
and you're familiar with SVGs,
you can write this code from scratch.
I'm not.
So what I do is find great templates online
and then modify them to suit my needs.
So here's one amazing site
where you can find some really cool templates.
It's called kerrykolosko.com.
And if you head to this website,
you can drill into templates
and you'll find SVG templates here.
And the one that I'm gonna use
is the gradient area sparkline with last point.
So what we can do here is scroll down
and you'll see all of this code
which defines that SVG visual.
You can click the clipboard to copy it
and let's head back to Power BI
and add this to a brand new measure.
So let's go to data, add a new measure,
and I'm just gonna go ahead and paste all that code in.
You can see it looks really scary.
We've got a bunch of errors,
but don't worry, with a little bit of deductive reasoning,
we can modify this to do exactly what we need.
So let's go ahead and change the measure title
to something like Revenue Sparkline.
Now, there're a couple updates that I need to make.
If you scroll through, you'll see a few places
where date fields are referenced from a financials table.
Obviously, we don't have a financials table in our model.
This is just a placeholder.
And we see a measure here called Sum of Gross Sales
that we'll need to swap in
for our total revenue measure as well.
So let's do our dates first.
And instead of financials[Date], I want this sparkline
to be at the monthly level.
So I'm gonna go to our calendar lookup
and find the start of month field.
And now I'm just gonna copy and paste that,
replace every instance that I can find
of financials[Date].
And you can see I've got a financials table reference here,
which will need to be updated with calendar lookup.
And now let's do the same thing with this measure.
Gonna change from sum gross sales to total revenue.
And there are a few instances where I'll need to copy
and paste that measure.
So I think I've gotten all
of the instances accounted for here.
And just to be clear, I really have no idea what a lot
of this code is doing,
especially this XML custom format stuff here at the end.
But it's pretty clear what fields we need to swap in
to customize this to suit our needs.
So let's go ahead and press enter here.
That's gonna save our measure.
And now let's go back to our visual, open up formatting,
head to images, and let's go to total revenue.
Get rid of that JPEG that we added.
And now instead of image, we're gonna use image URL
and click that function icon.
We're gonna use the field value format style
and base it on that measure we just created.
So let's press OK.
You can see a tiny 30 pixel image got added here
to the left of our label.
That's a good start, but obviously,
we need to do a little bit of format tweaking here.
So let's change our universal settings to bump this up
to like 200.
And instead of left of text, let's put it below the text,
do a little resizing, and that's looking pretty good.
The only thing I don't like is this kind of weird blue
and the fade to gray.
So let's go back to measures.
We'll search for that sparkline measure.
Now what I'm gonna do is look for these hex codes
and I'm gonna replace them with the 20E2D7,
and I'm gonna use a hex code for dark gray
to match the background, which is 333333.
So I'm gonna go through
and make those updates here, 20E2D7,
and instead of white, I'm gonna use another hex code.
Looks like I need to include the %23 for compatibility.
Then 333333.
For these stop-colors, I want that blue, E2D7.
And this will generally be a trial and error exercise.
You might make a few changes, save the measure,
see how it impacts the visual,
then go back and make some more.
That's kind of what I did here to realize
that these were the exact places
that I would need to make these changes.
So I think those hex code updates look good.
Last thing I wanna do
is just drop the stroke width down a little bit
from three to two for the line
and also for that last point.
And let's just scroll up, make sure things look good.
It looks like we need a hash
on that stop-color hex code right there.
And let's go ahead and press enter
and see how that impacted our visual.
So boom, check it out.
There is our beautifully formatted sparkline.
So there you have it.
That's our crash course in Power BI's brand new card visual.
Hope you found it helpful.
Hope you learned a thing or two,
and I will see you in the next one.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.