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 = ...
  • amitchandak's avatar
    amitchandak
    4 years ago

    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