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
Anonymous
Not applicable

Based on Selected value need to display a column

Hi All,

 

3.PNG

 

I have only one column in my table i.e., Alphabet column. I have placed it into a slicer and enabled select all option.

I would like to show the explanation of these alphabets in card. I want that "Explanation" i.e., the second table of column as a calculative column.

If i select "A" then it should diplay "This is the 1st alphabet"

If i select "B" then it should diplay "This is the 2nd alphabet"

If i select "C" then it should diplay "This is the 3rd alphabet"

If i select "Select All" then it should diplay "Please select any one alphabet"

 

Thanks in advance

2 ACCEPTED SOLUTIONS
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

How is this?

First, add a [index] column or a sorting coulmn.

(If you use conditional functions, such as IF or SWITCH. It can be cumbersome when you have too many rows.)

ff5.PNG

Then, Create a measure like this:

 

Measure 3 = 
VAR x = MAX('Table'[Index])
RETURN
IF(
    ISFILTERED('Table'[Alphabet]),
    "This is the" & " " & x & " " & "alphabet",
    "Please select any one alphabet"
)

 

ff6.PNGff7.PNG

 

Best regards,
Lionel Chen

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

Anonymous
Not applicable

Good point - the table[column] needs to be wrapped in a VALUES() function when in a measure.

 

ie. SWITCH( VALUES('Alphabet Table'[Alphabet]), etc etc

Though of course @v-lionel-msft response is a great answer for all instances of the alphabet!

View solution in original post

7 REPLIES 7
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

How is this?

First, add a [index] column or a sorting coulmn.

(If you use conditional functions, such as IF or SWITCH. It can be cumbersome when you have too many rows.)

ff5.PNG

Then, Create a measure like this:

 

Measure 3 = 
VAR x = MAX('Table'[Index])
RETURN
IF(
    ISFILTERED('Table'[Alphabet]),
    "This is the" & " " & x & " " & "alphabet",
    "Please select any one alphabet"
)

 

ff6.PNGff7.PNG

 

Best regards,
Lionel Chen

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

Adamtall
Resolver III
Resolver III

Hi,

Try below.

 

do a Index column and a measure",

Index = RANKX(ALL('Table');'Table'[Alphabet];;ASC)
 
Selected = IF(HASONEFILTER('Table'[Alphabet] );"This is the " & SELECTEDVALUE('Table'[Index]) & "st alphabet" ;"Please select any one alphabet")
 
Skärmklipp7.PNG

/Adam

Anonymous
Not applicable

You want to create a measure (not a calculated column) with the formula using a SWITCH / IF statements plus a test for SELECTEDVALUE or use IF(HASONEVALUE() or perhaps IF(HASONEFILTER() depending on what you need. E.g.

Alphabet = 
IF(HASONEVALUE('Table'[Column1]),
    SWITCH( 'Table'[Column1],
        "A", "This is the 1st alphabet",
        "B", "This is the 2nd alphabet",
        "This is all other values"
    ),
    "Please select any one alphabet"
)
 
Hope that helps!

 

Anonymous
Not applicable

Hi @Anonymous ,

 

Thanks for your replly but second line is showing error. It is expecting a measure value at the line of error.

 

4.PNG

Anonymous
Not applicable

If you look closely at your code you'll see you entered a table name on its own. My code showed table[column] in the first argument to the SWITCH statement.

Hopefully you've found the solution anyway from the other posts.

Anonymous
Not applicable

Hi @Anonymous ,

 

Thanks for helping me out but kust now i tried wit sample data and i tried to give colun name but it is not acceptingn it.

10.PNG

 

Note:Yes as you mentioned however we got solution from another post but anyway thanks for helping me out.

 

Thanks

Anonymous
Not applicable

Good point - the table[column] needs to be wrapped in a VALUES() function when in a measure.

 

ie. SWITCH( VALUES('Alphabet Table'[Alphabet]), etc etc

Though of course @v-lionel-msft response is a great answer for all instances of the alphabet!

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.