Forum Discussion

Umadhandapani's avatar
Umadhandapani
Helper II
4 years ago
Solved

Filter Selection

Required a measure where selecting  'Germany' filter it should return 'SalesvsProfit' value, if selecting any of the filter other than 'Germany' it should return blank.

 

In the above concept, if I multi-select 'Germany' along with 'Mexico' it should sum up with 'Germany' value + '0', to result the value. Is it possible?

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Umadhandapani ,

     

    Please try:

    Measure = 
    var _count=IF(ISFILTERED('Table'[Country]), COUNTX(ALLSELECTED('Table'[Country]),[Country]),0)
    var _ifselected=SUMMARIZE(ALLSELECTED('Table'),[Country])
    return SWITCH(TRUE(), _count=1 && MAX('Table'[Country])="Germany", [SalesvsProfit], _count>1 && "Germany" in _ifselected , [SalesvsProfit]+0,BLANK())

    If you want to actually show the "+0 " , please try:

    Measure 2 (Text) = 
    var _count=IF(ISFILTERED('Table'[Country]), COUNTX(ALLSELECTED('Table'[Country]),[Country]),0)
    var _ifselected=SUMMARIZE(ALLSELECTED('Table'),[Country])
    return 
    SWITCH(TRUE(), _count=1 && MAX('Table'[Country])="Germany",CONVERT( [SalesvsProfit],STRING), _count>1 && "Germany" in _ifselected , [SalesvsProfit] &" + 0",BLANK())

    But the measure type is text instead of Int:

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Umadhandapani ,

     

    Please try:

    Measure = 
    var _count=IF(ISFILTERED('Table'[Country]), COUNTX(ALLSELECTED('Table'[Country]),[Country]),0)
    var _ifselected=SUMMARIZE(ALLSELECTED('Table'),[Country])
    return SWITCH(TRUE(), _count=1 && MAX('Table'[Country])="Germany", [SalesvsProfit], _count>1 && "Germany" in _ifselected , [SalesvsProfit]+0,BLANK())

    If you want to actually show the "+0 " , please try:

    Measure 2 (Text) = 
    var _count=IF(ISFILTERED('Table'[Country]), COUNTX(ALLSELECTED('Table'[Country]),[Country]),0)
    var _ifselected=SUMMARIZE(ALLSELECTED('Table'),[Country])
    return 
    SWITCH(TRUE(), _count=1 && MAX('Table'[Country])="Germany",CONVERT( [SalesvsProfit],STRING), _count>1 && "Germany" in _ifselected , [SalesvsProfit] &" + 0",BLANK())

    But the measure type is text instead of Int:

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.