Forum Discussion

FIJT's avatar
FIJT
Frequent Visitor
4 years ago
Solved

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:

 

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.

 

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 🙂
  • 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

4 Replies

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

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        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