Forum Discussion

Farhan_Raza's avatar
Farhan_Raza
Frequent Visitor
3 years ago
Solved

Count Rows Within Table Chart

Hello everyone,

 

Is there a way to count rows within the table chart ? I have a date column coming from calender table and another column (margin) from a Table (Table B) and the rest are from another table (Table A). I want to count rows where margin is >=1000.

 

Table relationship is :
Calender -> Table A -> Table B (single and one to many)

 

Please help

I want to get 8 as final answer

  • Hi Farhan_Raza 
    Please try

    Count =
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                TableB,
                Calender[Date],
                TableA[PO#],
                "@Margin", SUM ( TableB[Margin] )
            ),
            [@Margin] >= 1000
        )
    )

3 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Farhan_Raza 
    Please try

    Count =
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                TableB,
                Calender[Date],
                TableA[PO#],
                "@Margin", SUM ( TableB[Margin] )
            ),
            [@Margin] >= 1000
        )
    )
    • Farhan_Raza's avatar
      Farhan_Raza
      Frequent Visitor

      Thank you so much. I knew it had to do with summarize function but I couldn't remember the format

    • Farhan_Raza's avatar
      Farhan_Raza
      Frequent Visitor

      A quick question, suppose the relationship is inactive between Table A & Table B, how do I incorporate within this formula ? Do I have to use USERELATIONSHIP function ?