none
Do you know the DAX for this please? RRS feed

  • Question

  • Hello. What is the DAX for select field1, count(distinct field2) AS myvalue from Table1 where field8 > 0 group by field1

    Thank you




    • Edited by arkiboys Tuesday, September 3, 2019 10:42 AM
    • Edited by Pete LakerMVP, Moderator Tuesday, September 3, 2019 11:15 AM edited to show problem in the list page - precis
    Tuesday, September 3, 2019 10:00 AM

Answers

  • Hi

    It is just a filter within the SUMMARIZE Function (Similar to Where clause before Group BY)- You can ignore it if there is no necessity.


    Thanks Please mark as answer if my post is helped to solve your problem and vote as helpful if it helped so that forum users can benefit

    • Marked as answer by arkiboys Saturday, September 7, 2019 8:24 AM
    Saturday, September 7, 2019 7:21 AM

All replies

  • Hi

    Please find the below query in DAX. Hope this meets your requirement.

    VAR TableMain =
        FILTER (
            SUMMARIZE (
                Table1[Field1],
                "Count", DISTINCTCOUNT ( Table2[Field2] )),
            [Total Sales] > 10
        )
    
    RETURN SUMX( TableMain, [Count])
    
    


    Thanks Please mark as answer if my post is helped to solve your problem and vote as helpful if it helped so that forum users can benefit

    Saturday, September 7, 2019 7:10 AM
  • Hi

    Please find the below query in DAX. Hope this meets your requirement.

    VAR TableMain =
        FILTER (
            SUMMARIZE (
                Table1[Field1],
                "Count", DISTINCTCOUNT ( Table2[Field2] )),
            [Total Sales] > 10
        )
    
    RETURN SUMX( TableMain, [Count])
    


    Thanks Please mark as answer if my post is helped to solve your problem and vote as helpful if it helped so that forum users can benefit

    Hello,

    What is

    [Total Sales] > 10

    referring to please?

    Saturday, September 7, 2019 7:18 AM
  • Hi

    It is just a filter within the SUMMARIZE Function (Similar to Where clause before Group BY)- You can ignore it if there is no necessity.


    Thanks Please mark as answer if my post is helped to solve your problem and vote as helpful if it helped so that forum users can benefit

    • Marked as answer by arkiboys Saturday, September 7, 2019 8:24 AM
    Saturday, September 7, 2019 7:21 AM
  • Can it be :

    VAR TableMain =
        FILTER (
            SUMMARIZE (
                Table1[Field1],
                "Count", DISTINCTCOUNT ( Table2[Field2] )),
            [Count] > 10
        )
    
    RETURN SUMX( TableMain, [Count])

    Saturday, September 7, 2019 7:34 AM
  • Yeah, you are correct.

    Thanks Please mark as answer if my post is helped to solve your problem and vote as helpful if it helped so that forum users can benefit

    Saturday, September 7, 2019 7:43 AM
  • Thank you
    Saturday, September 7, 2019 8:24 AM