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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
pdlv
Helper I
Helper I

Dynamic bin Column

I want to write a Column that when field filter is filtered it will get the value in field1 (bins) else it will get the value in field2 (bins)

I have tried this but it not work

DynamicColumn = IF(
    NOT(ISBLANK(SELECTEDVALUE(DataTable[filter]))),
    'DataTable'[field1 (bins)],
    'DataTable'[field1 (bins)]
)

 

anyone have solution for this case

2 ACCEPTED SOLUTIONS
VahidDM
Super User
Super User

In Power BI, calculated columns are evaluated during data refresh and are not affected by user interactions like slicer selections or report filters. This means that a calculated column cannot dynamically change based on whether a field is filtered in the report.

View solution in original post

FreemanZ
Super User
Super User

hi @pdlv ,

 

if you are writing a measure, try like:

DynamicColumn = IF(
    NOT(ISBLANK(SELECTEDVALUE(DataTable[filter]))),
    MAX('DataTable'[field1 (bins)]),
    MAX('DataTable'[field2 (bins)])
)

 

if you are writing a calculated column, this won't work, as calculated column/table is not supposed to respond to visual behaviors that you intend to capture with SELECTEDVALUE.

View solution in original post

3 REPLIES 3
pdlv
Helper I
Helper I

Thanks guys 😅

FreemanZ
Super User
Super User

hi @pdlv ,

 

if you are writing a measure, try like:

DynamicColumn = IF(
    NOT(ISBLANK(SELECTEDVALUE(DataTable[filter]))),
    MAX('DataTable'[field1 (bins)]),
    MAX('DataTable'[field2 (bins)])
)

 

if you are writing a calculated column, this won't work, as calculated column/table is not supposed to respond to visual behaviors that you intend to capture with SELECTEDVALUE.

VahidDM
Super User
Super User

In Power BI, calculated columns are evaluated during data refresh and are not affected by user interactions like slicer selections or report filters. This means that a calculated column cannot dynamically change based on whether a field is filtered in the report.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.