Forum Discussion

xum's avatar
xum
Frequent Visitor
1 year ago

Distinct count vs countrows summarize/group by

Hi,

In my model i got a column that's 50% of DB, that column was imported from SQL and it's the concatenation of column A, B, C, D (they are all integer).
I just use that column to get a measure with distinct count.

Instead of import that column, i just import the C and D column (A and B were already imported) with much less cardinality and reduce the size of my model.

And in my new measure i use:
countrows (Groupby A, B, C, D) instead of distinct count, but this one is a killer performance in DAX, we are talking about a table with 80M.

I'm not sure if that's confused or not.
Any suggestion or work around?

Thanks for ur time 🙂

4 Replies

  • Deku's avatar
    Deku
    Super User

    You can try the below, you might get a better query plan. Check the server timings in DAX studio for the various options.

     

    Sumx(

    summarize( 

    Table,

    Table[a],

    Table[b],

    Table[c],

    Table[d]

    )

    ,1

    )

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi xum,

     

    Thanks Deku for Addressing the issue.

     

    we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
    If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

     

    Regards,
    Vinay Pabbu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi @xum,

       

      we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
      If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

       

      Regards,
      Vinay Pabbu

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi xum,

         

        May I ask if you have gotten this issue resolved?

        If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.

         

        Regards,
        Vinay Pabbu