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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

How to create custom column for a slicer

Hi everyone, 

 

I am new to PowerBi and have quick question. I want to create new collumn called 'country' that would allow me to put it into slicer and when I select specific country it will update the chart accordingly. So for example: if I select Austria from slicer the chart will automatically show values from AT.Buil.  Later on I will add more categories and charts like AT.Service, AT.Retail, etc and ultimately I want that whenever I select any of the countries all charts will show the values on charts. If you have suggestions how to go around this problem and make it more effective, I would highly appreciate that. Thank you. 

Capture.PNG

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may try to use SELECTEDVALUE Function and SWITCH Function to create the measure as requested. For example:

Value =
SWITCH (
    SELECTEDVALUE ( Country[Country] ),
    "a", CALCULATE ( SUM ( Table[AT.BUIL] ) ),
    "b", CALCULATE ( SUM ( Table[AT.BUIL2] ) )
)

1.png

 

Regards,

Cherie

Community Support Team _ Cherie 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

4 REPLIES 4
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may try to use SELECTEDVALUE Function and SWITCH Function to create the measure as requested. For example:

Value =
SWITCH (
    SELECTEDVALUE ( Country[Country] ),
    "a", CALCULATE ( SUM ( Table[AT.BUIL] ) ),
    "b", CALCULATE ( SUM ( Table[AT.BUIL2] ) )
)

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you mate you are a legend.  Also, one more if you or anyone could help me with. Have same dates tables across different categories and I want to add all of those dates into one measure so I could add to slicer and then update all sentiment charts similarly as I do with countries. I have tried to use same method but no luck so far. Any advice?Capture.PNG

 Thanks in advance

 

Hi @Anonymous

 

It seems you may try to create a calendar table with date column and link it with other tables. Then use the date column as slicer. You may have a look at below article about relationship.

https://docs.microsoft.com/en-us/power-bi/desktop-create-and-manage-relationships

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Cherie, 

 

I was thinking about creating relationship between dates, however since I linked data from a excel file that is on my onedrive, all the manage relationship buttons are greyed out in pbi desktop. So either have to find a work around or go to the initial excel file and try to do change there. 

Capture.PNG 

 

I would appreciate any advice on that. 

 

Regards, 

Arnold

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.