Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Add column according to values from different rows

I created this simplified table of my data:    Country Value Year Result France 2300 2021 Both Spain 5432 2021 Only '21 Germany 0 2021 Only '22 Italy 0 2021 None Fr...
  • zzcc's avatar
    5 years ago

    Hi, Anonymous 

     

    try to create a measure like this:

    Measure = 
    var _t=FILTER(ALL('Table'),'Table'[Country]=MAX('Table'[Country]))
    var _t2=FILTER(_t,[Value]>0)
    var _t3=
    SWITCH(COUNTROWS(_t2),2,"Both",1,"Only"&MAXX(_t2,[Year]),"None")
    return _t3

    result:

     

     

    Best Regards

    zc

    Did I answer your question? Mark my post as a solution!