Using Text Measures in Multi-row Cards in Power BI

A not-so-well-known feature of the multi-row card visual in Power BI is that it can have its own title, called Card Title, in addition to the title any visual can have. In the image above, the Card Title is blue, and it is formatted separately from the visual title. It only works if you use one measure that returns text, and all other visuals are not text. In this blog post, I’m sharing a technique to display text as values in a multi-row card and still have the special Card Title.

The Problem

Let’s say you create a multi-row card with Card Title and two numeric measures. The measures are as follows:

Title = "This is a multi-row card title"

Some Number = 1

Another number = 2

The result is going to be similar to the following:

Visualizations

Now let’s say you want to add a text measure to the visual:

Some text (wrong) = "a"

As soon as you drop the measure in the field well, your visual will look as follows:

Visual title

The problem is that to use the Card Title, you must have exactly one measure that returns text, and in this case we have two, so Power BI can’t tell which one is Card Title.

The solution

To use a text measure as a value in a multi-row card, we can tamper with data types a bit. What looks like text but is not text? The Variant data type.

You can’t set the type of a measure to Variant yourself, but you can write DAX that instructs Power BI that a measure can potentially return different data types. We can write a measure as follows:

Some text = IF(TRUE, "a", 1)

This measure will never return 1, but this does not stop Power BI from setting its type to Variant behind the scenes. Now that it’s not text, we can have the Card Title:

Visual title

Thanks to Reid Havens for inspiring me to write this blog post 😊

About the Author:

Daniil Maslyuk is an independent consultant who specializes in Microsoft Power BI. He is the author of the official Power BI exam reference book, a trainer and speaker.

Reference:

Maslyuk, D. (2020). Using text measures in multi-row cards in Power BI. Available at: https://xxlbi.com/blog/multi-row-card-title/ [Accessed: 1st of April 2020].

Share this on...

Rate this Post:

Share:

Topics:

Power BI