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
Putoc93
New Member

Dinamic title - if condition

Hello,

I am new to this forum but I couldn't find any similar thread with the problem I am facing.

So I have a card which I want to have a dinamic title. I already went to conditional formating function for the title but I am not very experinced with the query functions.
I have a slicer and I was able to create a title with the name of the chosen category on that slicer:

Dynamic Title =
"Category is " &SELECTEDVALUE(Table[Category])

But my goal is to present a specific string hardcoded on the title when one of the four categories is chosen on the slicer. So on the function I want to have four conditional lines to parse what Category was chosen and have a different title based on that.
Example:
If Category 1 is chosen: Text one.
If Category 2 is chosen: Text two..
If Category 3 is chosen: Text three.
If Category 4 is chosen: Text four.

Is there any possibility to do this?

Thank you in advance for your time!!

Best regards
1 ACCEPTED SOLUTION
ghoshabhijeet
Solution Supplier
Solution Supplier

@Putoc93  Yes, you can achive this with the SWITCH function. Here is my solution. Hope this works for your requirement.

1. Create a measure in the similar fashion with your required text.

 

Text Based on Category = SWITCH(
TRUE(),
MIN('DataTable'[Category]) = "Category 1", "Text One",
MIN('DataTable'[Category]) = "Category 2", "Text Two",
MIN('DataTable'[Category]) = "Category 3", "Text Three",
MIN('DataTable'[Category]) = "Category 4", "Text Four"
)

2. Once the measure is created put it in the card visual and here is the result.

 

ghoshabhijeet_0-1654541914226.png

 

** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you !

Good Luck 👍

 

View solution in original post

3 REPLIES 3
ghoshabhijeet
Solution Supplier
Solution Supplier

@Putoc93  You are welcome 😊 ..Glad I could help 👍

ghoshabhijeet
Solution Supplier
Solution Supplier

@Putoc93  Yes, you can achive this with the SWITCH function. Here is my solution. Hope this works for your requirement.

1. Create a measure in the similar fashion with your required text.

 

Text Based on Category = SWITCH(
TRUE(),
MIN('DataTable'[Category]) = "Category 1", "Text One",
MIN('DataTable'[Category]) = "Category 2", "Text Two",
MIN('DataTable'[Category]) = "Category 3", "Text Three",
MIN('DataTable'[Category]) = "Category 4", "Text Four"
)

2. Once the measure is created put it in the card visual and here is the result.

 

ghoshabhijeet_0-1654541914226.png

 

** If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution, so that it comes in top of the search and help others. Thank you !

Good Luck 👍

 

Thank you very much ghoshabhijeet!
This was exactly what I was looking 😀

Regards.

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.