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
CastroRibeiro
Helper I
Helper I

Return a column value on a card, based on a condition

I am creating a tooltip, but I need the same tooltip to return values from different columns

 

So I need to do something like this:

If table[sports] = "Soccer" returns column table[playersSoccer],

If table[sports] = "Baseball" returns column table[playersBaseball]...

 

This dax would be on a card, and when the user hovers over it, it will show the value based on the sports table

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @CastroRibeiro ,

I created some data:

Table:

vyangliumsft_0-1689927456445.png

Columntable:

vyangliumsft_1-1689927456446.png

Here are the steps you can follow:

1. In power query  -- Select all – Transform – Unpivot Columns.

vyangliumsft_2-1689927471954.png

vyangliumsft_3-1689927471954.png

2. Create calculated column.

Column =
var _len=LEN('columntable'[Attribute])
return
RIGHT(
    'columntable'[Attribute],_len - 7)

vyangliumsft_4-1689927489746.png

3. Join the relationship between two tables.

vyangliumsft_5-1689927489748.png

4. Check out the link below to use Tooltip.

Create report tooltip pages in Power BI - Power BI | Microsoft Learn

5. Result:

vyangliumsft_6-1689927515805.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @CastroRibeiro ,

I created some data:

Table:

vyangliumsft_0-1689927456445.png

Columntable:

vyangliumsft_1-1689927456446.png

Here are the steps you can follow:

1. In power query  -- Select all – Transform – Unpivot Columns.

vyangliumsft_2-1689927471954.png

vyangliumsft_3-1689927471954.png

2. Create calculated column.

Column =
var _len=LEN('columntable'[Attribute])
return
RIGHT(
    'columntable'[Attribute],_len - 7)

vyangliumsft_4-1689927489746.png

3. Join the relationship between two tables.

vyangliumsft_5-1689927489748.png

4. Check out the link below to use Tooltip.

Create report tooltip pages in Power BI - Power BI | Microsoft Learn

5. Result:

vyangliumsft_6-1689927515805.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Ritaf1983
Super User
Super User

Hi @CastroRibeiro 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

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.