Forum Discussion

richardnlove918's avatar
richardnlove918
Frequent Visitor
7 years ago
Solved

Dax Question

I have a DAX question regarding a function that is supposed to count the instances of an average value.   The image below shows correct results for the table to the left however the table to the ri...
  • OwenAuger's avatar
    7 years ago

    Hi Richard,

     

    I am assuming your [AVGQ] measure is defined as AVERAGE ( 'Data'[qValue] ) ?

     

    I would suggest rewriting your measure like this:

    # Rows with Same Avg Value = 
    VAR CurrentAverage = [AVGQ]
    RETURN
    COUNTROWS ( 
        FILTER (
            ALLSELECTED ( Data[Site] ),
            CurrentAverage = [AVGQ]
        )
    )

    From reading your post, it looks like you want to retain the UID filter if any, and count the number of Site values (rather than the number of rows of data) for which the average qValue is the same as in the current filter context.

     

    This works in a test model I created at my end. Please post back if needed.

     

    Regards,

    Owen