Forum Discussion

e175429's avatar
e175429
Icon for Helper IV rankHelper IV
3 years ago
Solved

Calculate with a filter on 2 fields

Hey All,

 

I would like to create a measure that shows me "how many of bytes are promoters"?

 

I created this measure:

BSS Promoter = COUNTX(FILTER(Cleaned, Cleaned[ID] = "Promoter"), Cleaned[Section.] = "bytes")

 

But that gives me a error.

 

Cleaned = table name

NPS = field

Section = field

 

So, how do I create a measure with a filter on 2 columns?

 

Thank you!

  • I figured it out. I had to put calculate first. 

     

    so its:

     

    BSS Promoter = CALCULATE(COUNTROWS(Cleaned),
                               FILTER(Cleaned, Cleaned[ID] = "Promoter"),
                               FILTER(cleaned, cleaned[Section.]="bytes"))

3 Replies

  • hi e175429 

    Try like:
    BSS Promoter =
    COUNTROWS(
        FILTER(
            Cleaned, 
            Cleaned[ID] = "Promoter"
                &&Cleaned[Section] = "bytes"
         )
    )
    • e175429's avatar
      e175429
      Icon for Helper IV rankHelper IV

      When I try that, I get this error:

       

       

  • I figured it out. I had to put calculate first. 

     

    so its:

     

    BSS Promoter = CALCULATE(COUNTROWS(Cleaned),
                               FILTER(Cleaned, Cleaned[ID] = "Promoter"),
                               FILTER(cleaned, cleaned[Section.]="bytes"))