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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
FIJT
Frequent Visitor

Calculate column based on filtered values

Hello everybody,

 

I'd like to ask you for help with a calculated column.

I have created a following column:

FIJT_0-1632468731565.png

 

Where Optimal Energy is calculated with:

 

Optimal Energy = VAR __Energy = [Energy Cost]

VAR __MinPrevInvestment = MINX(FILTER('Table',[Energy Cost]<__Energy),[Investment])

RETURN
IF([Investment]<__MinPrevInvestment, [Energy Cost], BLANK())
 
When I use a slicer filter in the report for energy cost, the column does not update the calculation.
FIJT_1-1632469173834.png

 

I've tried to use ALLSELECTED in the formula, but can't seem to make it work.

 

Is there a way to update the calculated column based on filtered values?
 
Thanks for reading 🙂
1 ACCEPTED SOLUTION

@FIJT , Measure display depend on visual group bys

 

like

 

Optimal Energy = VAR __Energy = max(Table[Energy Cost])
VAR __MinPrevInvestment = MINX(FILTER(allselected('Table'),[Energy Cost]<__Energy),[Investment])

RETURN
IF(max([Investment])<__MinPrevInvestment, sum([Energy Cost]), BLANK())

 

or force a row context

 

RETURN
sumx(Values(Table[ID]), IF(max([Investment])<__MinPrevInvestment, sum([Energy Cost]), BLANK()) )

 

A row context of id is pushed in last return

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@FIJT , A calculated column can not get updated with a slicer value. Slicer values can only be used measures

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak Is there a way to make the calculated column as a measure?

@FIJT , Measure display depend on visual group bys

 

like

 

Optimal Energy = VAR __Energy = max(Table[Energy Cost])
VAR __MinPrevInvestment = MINX(FILTER(allselected('Table'),[Energy Cost]<__Energy),[Investment])

RETURN
IF(max([Investment])<__MinPrevInvestment, sum([Energy Cost]), BLANK())

 

or force a row context

 

RETURN
sumx(Values(Table[ID]), IF(max([Investment])<__MinPrevInvestment, sum([Energy Cost]), BLANK()) )

 

A row context of id is pushed in last return

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you so much!

 

I used this to create multiple measures (don't know if it was necessary) ->

 

Measure 1 = MAX(Table[Investment])

Measure 2 = MAX(Table[Energy Cost])

Measure 3 =MINX(FILTER(allselected('Table'),[Energy Cost]<[Measure 2])),[Investment])

Measure 4= IF([Measure 1]<[Measure 3],[Measure 2],IF([Measure 3]<1,[Measure 2],BLANK()))

 

Measure 4 gives me the correct value and reacts to filters applied on the page. (Had to add the last IF, because it would skip the 1st value for some reason)

 

Thanks again @amitchandak 🙂

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors