Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BeginnerBI
Helper I
Helper I

SWITCH SQL STATEMENT

Hello!

 

I am working with Paginated Reports aka Power BI Report Builder and I have a challenging scenario.

 

The scenario is that in the column B I have different values tied to an specific category but the title dont change.

 

Example: 

I have

Column 1 (Type)

Clothes

Transportation

Food

 

and in the column 2 (Address)

Red

Blue

1

2

3

456 S Drive Miami

115 W Pine Ohio

 

You will notice that the same column have different description.

 

How can I do in SQL or Power BI so when the end user select 'Clothing' the header title switch to its category.

 

It can be hard to understand.  Please advise

 

1 REPLY 1
Sahir_Maharaj
Super User
Super User

Hello @BeginnerBI,

 

One way to achieve this is by using a dynamic header that changes based on the selected category.

 

1. Create a parameter in the report for the category selection

2. Use an expression to set the column header based on the selected category. You can use the IIF() function to set the header dynamically based on the selected parameter value.

 

For example, the expression for the header of Column 2 could be:

=IIF(Parameters!Category.Value = "Clothes", "Clothes Address", IIF(Parameters!Category.Value = "Transportation", "Transportation Address", IIF(Parameters!Category.Value = "Food", "Food Address", "")))

 

You can use similar expressions to dynamically set the headers of other columns in the report.

 

Hope this helps! Let me know if you have any other questions.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.