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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
PHDurand
Helper I
Helper I

Help - Switch formulas for dynamic column selection

Hi,

I need some help on using the SWITCH function for dynamis based on a measure.

 

I tried to add a calculated column which can diplay another column of the same table depending of a value: Value 1 will disply column A, Value 2 will display column B,....

The Value is determined by a measure based on a table not linked to the previous one.

 

Tables look like:

Column AColumn BColumn CSWITCH
abc 
aabbcc 
aaabbbccc 

 

Selection
1
2
3

 

So if I select 1 from the Selection Table, then the SWITCH column from the other table will diplay column A.

 

Value is determined by the following measure:

- Measure = MIN('Selection'[Selection])

SWITCH column is as below:

- SWITCH = SWITCH([Measure];1;[Column A];B;;[Column B];C;;[Column C])

 

But when I tried to use in a visual I always get Column A in SWITCH whatever is selected in Measure.

See below an example: we see Measure = 2 & I should see the column B values. But instead I always got the column A

Capture.PNG

 

Do you know what is wrong with the Switch function ?

Thanks

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@PHDurand ,

 

Values in a calculated column are fixed. You'll need to create a measure.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Actually I already tried to built it as a measure. The problem is that the measures are added in visuals. As I want to keep the result as a distinct value (no aggregation) I was trying to built it as a custom column.

Is there any option "don't summarize" to apply on measures ? Or any way to change the formulas & make sure all resulta are distincts ?

 

Thanks

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.