Forum Discussion

Hitman's avatar
Hitman
New Member
8 years ago
Solved

Count Sta.Dev above a thredshold.

Hi,

 

I have a small problem with DAX... How do I count Sta.Dev above 0.5?

(Concentrations are grouped by Month, Date and CowNo)

  • Hi Hitman,

    Please create a measure using the formula and check if it works fine. 

    result =
    CALCULATE (
        COUNTROWS ( ALLSELECTED ( Table[Standardndeviation of concentration] ) ),
        FILTER (
            Table,
            [Sta.Dev] > 0.5
                && Table[CowNO] = "Standardndeviation of concentration"
        )
    )
    


    Table means your resource table. I test it using my sample table, it works successfully. Please see the following steps in my scenario.

    1. My sample table named "Table4"

    Table4
    2. Create a visual like you, click "See data", I want to count "Count of region"(the value in visual) above 1.

    visualsee data

    3. So I create a measure using the formula.

    result = CALCULATE(COUNTROWS(ALLSELECTED(Table4[Region])),FILTER(Table4,COUNTA(Table4[Region])>1&&Table4[Region]="B"))


    I will get the expected result.



    Best Regards,
    Angelia

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Hitman,

     

    If i understand it correctly you want a count of all the sta.dev that are 0.5 or higher.

     

    you could try this code:

    Measure = COUNTROWS(filter(table1,table1[sta.dev]>=0.5))

    I have'nt test it so let me know if it works !

     

     

    regards,

    L.Meijdam

    • Hitman's avatar
      Hitman
      New Member

      Hi Anonymous,

       

      Thank you for your reply.

       

      The chanllange for me is to get "table1".

      Screendump is from "See Data" of the visual. Here the table is generated, but how do I do that with DAX syntax?

      How can I get DAX to understand that the count/filter functions should be applyed after a list of standard deviations has been made?

       

      Best Regards,

      H.

      • v-huizhn-msft's avatar
        v-huizhn-msft
        Microsoft Employee

        Hi Hitman,

        Please create a measure using the formula and check if it works fine. 

        result =
        CALCULATE (
            COUNTROWS ( ALLSELECTED ( Table[Standardndeviation of concentration] ) ),
            FILTER (
                Table,
                [Sta.Dev] > 0.5
                    && Table[CowNO] = "Standardndeviation of concentration"
            )
        )
        


        Table means your resource table. I test it using my sample table, it works successfully. Please see the following steps in my scenario.

        1. My sample table named "Table4"

        Table4
        2. Create a visual like you, click "See data", I want to count "Count of region"(the value in visual) above 1.

        visualsee data

        3. So I create a measure using the formula.

        result = CALCULATE(COUNTROWS(ALLSELECTED(Table4[Region])),FILTER(Table4,COUNTA(Table4[Region])>1&&Table4[Region]="B"))


        I will get the expected result.



        Best Regards,
        Angelia