Forum Discussion

Roym's avatar
Roym
Icon for Helper IV rankHelper IV
4 years ago
Solved

Filter on Count is not one

I have two tables in my dataset that are linked via the 'element' column. Next I created the below measure that will show a '1' if there if there is a link, and otherwise the measure remains empty. When I add this measure in my report to a table it works perfectly. I show the control name, and then it shows a '1' if there is a link, and remains empty if there is no link. But now I try to filter the table so that it only shows control names when there is no link. I tried all options like 'Is empty' 'Is less then 0' etc. But what ever option I try the table remains empty. What do I need to do to make this work?

 

I also tried the other way around, so the same field, and then filter on 'Is' '1'.  and then it indeed shows the control names were the count is 1. 

 

Count = CALCULATE ( DISTINCTCOUNT(Table_Issues[Name]),
KEEPFILTERS (Table_Controls[Name] <> "0"))

 

Controls

NameElement
control1Element2
control2 

 

Issues

NameElement
Issue1Element2
Issue2Element2
  • Hi Roym ,

     

    Please try to add "+0" with your measure like so:

     

    Count = CALCULATE ( DISTINCTCOUNT(Table_Issues[Name]),
    KEEPFILTERS (Table_Controls[Name] <> "0")) + 0
     
    Then filter with "is 0" and you will get what you want.

     

     

    Best Regards,

    Icey

     

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

6 Replies

  • Icey's avatar
    Icey
    Icon for Community Support rankCommunity Support

    Hi Roym ,

     

    Please try to add "+0" with your measure like so:

     

    Count = CALCULATE ( DISTINCTCOUNT(Table_Issues[Name]),
    KEEPFILTERS (Table_Controls[Name] <> "0")) + 0
     
    Then filter with "is 0" and you will get what you want.

     

     

    Best Regards,

    Icey

     

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

  • Roym , Not very clear on expected output, check if this measure can help

     


    Count = CALCULATE ( DISTINCTCOUNT(Table_Issues[Name]),
    filter (Table_Controls , not(isblank(Table_Controls[Element] )) ) )

    • Roym's avatar
      Roym
      Icon for Helper IV rankHelper IV

      amitchandak Unfortunatly same result. So the table in my report is:

       

      Control nameCount
      Control11
      Control2 

       

      So it shows a '1' if there is a link. That works perfectly, but when I try to filter the results (not equal to 1, is blank etc.) if shows no results at all 😞

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        Roym , Try this, Or share the expected output

         

        Count =

        var _1 = CALCULATE ( DISTINCTCOUNT(Table_Issues[Name]),
        filter (Table_Controls , not(isblank(Table_Controls[Element] )) ) )

        return

        if(Isblank(_1), 1, blank())