Forum Discussion

vgeldbr's avatar
vgeldbr
Helper IV
4 years ago
Solved

Calculated Column across row context

I'm stumped. I want to create a calculated column for purposes of filtering and slicing the table but I need the value to consider other rows in the table. Consider the table below:   I would...
  • ValtteriN's avatar
    4 years ago

    Hi,

    For this kind of filtering I would create a filter measure and apply it to your visual.
    So e.g. here we only keep rows where our item's material is Wood

    Filter when item =
    var _item = MAX(ItemExample[Item]) return
    IF(COUNTROWS(FILTER(all('Matrix example'),'Matrix example'[Item]=_item&&'Matrix example'[Material]="Wood"))>0,1,0)


    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!


     

  • PaulOlding's avatar
    4 years ago

    Hi vgeldbr 

    Here's some DAX for a calculated column

    Is MFS = 
    VAR _Rows = 
    CALCULATE(
        COUNTROWS(Products),
        Products[LeadershipRptInvestGroup] = "MFS Production Cloud",
        ALLEXCEPT(Products,Products[Product])
    )
    RETURN
        _Rows >= 1

    which gets you a True/False column