Forum Discussion

JamesBurke's avatar
JamesBurke
Helper III
1 year ago
Solved

Count rows

Hi all ,      Have all of the rows attached with 5 different Meters  , looking to make a column that counts the rows    Health = IF([UsagesCount test 2] > 48 = "Not Connected" , "Connecte...
  • Bibiano_Geraldo's avatar
    1 year ago

    Hi JamesBurke ,
    First of all, your Health measure needs some adjustments to work correctly in DAX. The IF function is being used incorrectly, and the syntax needs to be fixed. Here’s how it should look:

     

    Health = IF([UsagesCount test 2] >= 48, "Connected", "Not Connected")

     

     

    NOTE: If the above measure help your problem you cant stop right here, if not, please follow the bellow steps.

     

    Try to first Create a Calculated Column to Count Rows by this DAX:

     

    RowCount = 
    CALCULATE (
        COUNTROWS('National Grid Data'),
        FILTER (
            'National Grid Data',
            'National Grid Data'[Meter ID] = EARLIER('National Grid Data'[Meter ID]) &&
            'National Grid Data'[Date] = EARLIER('National Grid Data'[Date])
        )
    )

     

     

    Now, create another calculated column to determine the health status based on the row count by this DAX:

     

    Health = 
    IF (
        [RowCount] >= 48, 
        "Connected", 
        "Not Connected"
    )

     

     

    This approach ensures that you are evaluating the connectivity status for each meter based on the number of data points recorded for each day.

    If this reply help you, please accept as solution and give a Kudo.

     

    thank you