Forum Discussion

inglexjc's avatar
inglexjc
Post Patron
3 years ago

Count rows based on data from a Measure

I have a measure so that my Column in my table "Letter Due to Supervisor" shows up blank/no date if in the Descritpion shows "Letter Wavied".  Trying to get an accurate count of how many rows do have dates showing.  But the count is not working because the data is based on a measure.

 

Letter Due to Supervisor Measure = IF(CONTAINSSTRING(MAX('Legal Files'[Description_1]), "Letter Waived")," ", MAX('Legal Files'[Letter Due to Supervisor]))
 

 

How do I get it to count correctly?

 
 

14 Replies

  • bolfri's avatar
    bolfri
    Solution Sage

    Can you post here a pbix file or sample records in the table (not in the viz)?

  • themistoklis's avatar
    themistoklis
    Community Champion

    inglexjc 

     

    Why are you trying to use the column with dates and not the description column:

     

    Try measure below:

    Measure = COUNTROWS(FILTER(Sheet1, Not(CONTAINSSTRING(Sheet1[Description], "Letter Waived"))))
    • inglexjc's avatar
      inglexjc
      Post Patron

      I can have it count the Description as long as it doesn't count where it says "Letter Waived"

      Using:

      Measure = COUNTROWS(FILTER('Legal Files', Not(CONTAINSSTRING('Legal Files'[Description_1], "Letter Waived"))))  It's counting 995 it should only be 63.  So it looks like it's not counting the row.
      • themistoklis's avatar
        themistoklis
        Community Champion

        can you share the full dataset with us... if it doesnt contain any sensitive data

        IM saying this because it works on the sample dataset you sent

         

        Also in you formula you use a field called Description_1 ... in your message the field is Description (with the _1)

  • Table looks like this:

    I have Measure to high light "Letter Wavied" in blue:

    Measure 4 = IF(CONTAINSSTRING(SELECTEDVALUE('Legal Files'[Description_1]),"Letter Waived"),"blue","black")
     
    And Measure to make date for Letter Due to Supervisor to be blank:
    Letter Due to Supervisor Measure = IF(CONTAINSSTRING(MAX('Legal Files'[Description_1]), "Letter Waived")," ", MAX('Legal Files'[Letter Due to Supervisor]))
     
    I need the count to correctly count how many rows have a Date in the Letter Due to Supervisor.
     
    Does this help?

     

    • bolfri's avatar
      bolfri
      Solution Sage

      Not really. You're still showing us the viz table and we need a source table to understand the problem and help you with that. What I've understend from this one is that you have something like this:

      DateDescription_1Division
      2022-12-28Sample descriptionA
      2022-12-19Another descriptionA
      2022-12-20Dummy textA
      2022-12-21Letter WaivedB
      2022-12-20Another descriptionB
      2022-12-19Sample descriptionB

       

      And you want to achive something like this:

      Max date per divisionMax of Description_1DivisionCount rows with max date (?)
      2022-12-20Dummy textA3
      Blank because any of description for division B has description_1 Letter WaivedLetter WaivedB0
        SUM:3

       

      Is that correct?

      • inglexjc's avatar
        inglexjc
        Post Patron

        Yea I can't share the data source because it has PPI.  I'm wanting the count to be a separate visual.  But I can try this forumal to see if that will work.