Forum Discussion

Newkidonblock22's avatar
Newkidonblock22
Regular Visitor
2 years ago
Solved

I NEED HELP TO COUNT ROWS FOR A PARTICULAR CONSOLIDATED YEAR CATEGORY

THERE TRHEE TRANSACTIONS UNDER THIS COLUMN

There are 3 transactions under this column which are renew policy, new business, and cancellation. I need help to countrows for renew policy or new business and write the measure for 2023 & 2024. Thank you!!

  • audreygerred's avatar
    audreygerred
    2 years ago

    Woops - sorry - I missed the part where you mentioned the years. The below will give you the row count for renew or new and the years of 2023 and 2024.

     

    FilteredRowCount := 
    CALCULATE(
        [Row Count],
        'YourTable'[Transaction] IN { "Renew policy", "New business" },
        YEAR('YourTable'[Date]) IN {2023, 2024}
    )

      

3 Replies

  • Hello! First, you can create a measure for total rows:

    Row Count = COUNTROWS([YourTable])

    COUNTROWS function (DAX) - DAX | Microsoft Learn

     

    Then, you can click the three dots on that measure and click New quick measure. Select Filtered value from the dropdown in the quick measure pane, add in your transaction field and select Renew Policy, then click add. Then, change Renew Policy to New Business and select add again.

     

    The DAX will be like this: 

    Row Count for Renew Policy =
    CALCULATE([Row Count], 'YourTable'[Transaction] IN { "Renew policy" })
  • Thank you. I already established that. The problem I am having is how do I filter for different years as I am working on a consolidated report 

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

      Woops - sorry - I missed the part where you mentioned the years. The below will give you the row count for renew or new and the years of 2023 and 2024.

       

      FilteredRowCount := 
      CALCULATE(
          [Row Count],
          'YourTable'[Transaction] IN { "Renew policy", "New business" },
          YEAR('YourTable'[Date]) IN {2023, 2024}
      )