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
Charu
Post Patron
Post Patron

Display Text type column data for the selected filter value in Power BI Desktop using DAX

Dear Community,

Hope all are doing well and safe.

 

I'm trying to display the text type column data for the filters user selects in report.

For example I have two columns called Color and Type,When the user select Type from the slicer then the color for that selected type should display in Multi-row card visual. If nothing got filtered then the card should display blank

Color | Type
A | 1
B| 1
C | 2

D | 2
E | 2
P | 3

L | 4

Here when I select the type 2 and 3 it should show the related color value but initialy without any filters got selected the card visual should display blank.

I have tried isfiltered,allselected functions but getting an error saying cannot compare type text with True/False.

Kindly please help me acheive this.

Thanks in advance

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

put color in a multi card visual. Then create a measure to filter this visual:

ColorFilter= IF(ISFILTERED(table[type]), 1, 0)

Add the new ColorFilter measure to the filters for the card visual and filter forColorFilter is 1

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

8 REPLIES 8
AllisonKennedy
Super User
Super User

put color in a multi card visual. Then create a measure to filter this visual:

ColorFilter= IF(ISFILTERED(table[type]), 1, 0)

Add the new ColorFilter measure to the filters for the card visual and filter forColorFilter is 1

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi @AllisonKennedy 

#Lifesaver

I tried your solutions and It works as expected,Thank you so much for your timely support. 

@Charu
Glad it worked!

Please mark the solution that helped you so others in the community can find it more easily and know that your problem has been solved.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

MFelix
Super User
Super User

Hi @Charu ,

 

You need to create the following measure:

 

 

 

Colours = 
IF (
    ISFILTERED('Table'[Type] ),
        
    
    CONCATENATEX ( 'Table', 'Table'[Color], ", " )
)

 

 

 

 

Pbix File attach


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix 

I did try your measure which is working fine with my sample data but with the real data I'm getting the duplicates.

Here I have attached the screenshots for your reference.

 

Screenshot 1 : original column from the table

Charu_0-1597836351453.png

 

Screenshot 2 : For the original data the measure returns duplicated data but the expected result is Same as screenshot 1

 

Charu_1-1597836961983.png

 

Screenshot 3: With the sample data everything works fine.with out any filters visua appears blank and when we select it shows the related color data

Charu_2-1597837092635.png

 

Charu_3-1597837146544.png

Any thoughts why the screenshot2 returns data in such a way?

 

Thanks inadvance

Hi  @Charu ,

 

Does your original table has duplicate values on the lines? the concatanex uses the full table so it's not checking if there is duplicates or not you can redo your measure to:

 

Colours = 
IF (
    ISFILTERED('Table'[Type] ),
        
    
    CONCATENATEX ( DISTINCT('Table'[Color]), 'Table'[Color], ", " )
)

Basically just concateate the distinct values of the colours.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix 

Original data has no duplicates,you could take a look at screenshot 1 which is the original data for specific type filtered.

Hi @Charu,

 

Sorry for insisting on this but when I ask if there is duplicates is on the data itself not on the values.

 

In the sample data I have tested duplicating a row and got the same result has you did so additional color with the same value, making use of the second formula error dissappear. 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.