Forum Discussion

Umadhandapani's avatar
Umadhandapani
Helper II
4 years ago
Solved

Filter Condition

Multiple filter condition;

1) If I select 'Germany' it should return Profitsum value, if I select any other apart from 'Germany' it should return '0'

2) When I multiselect, along with Germany and some other country, it shold sum the 'Profitsum' value + 0

 

  • Hi,

    Try this logic:

    Measure 11 = SWITCH(true(),max('Matrix example'[Brand])="Metal","result 1",
    ISFILTERED('Matrix example'[Brand])&&
    COUNTROWS(FILTER('Matrix example','Matrix example'[Brand]="Metal"))=1,"result 2","result 3")

     

    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!


2 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    Try this logic:

    Measure 11 = SWITCH(true(),max('Matrix example'[Brand])="Metal","result 1",
    ISFILTERED('Matrix example'[Brand])&&
    COUNTROWS(FILTER('Matrix example','Matrix example'[Brand]="Metal"))=1,"result 2","result 3")

     

    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!


  • Umadhandapani , Try a new measure like

     

    measure =
    var _1 = countrows(allseleceted(Table[Country])
    var _2 = countrows(filter(allseleceted(Table[Country]), Table[Country] = "Germany"))
    return
    Switch( tru(),
    isblank(_2) , 0 ,
    _2 =_1 = sum(Table[Profitsum])+0 ,
    sum(Table[Profitsum])
    )