Forum Discussion

JM_nxgn's avatar
JM_nxgn
Icon for Helper I rankHelper I
7 years ago
Solved

DAX DistinctCount with SUMX totals

Hi, I know there are quite a few of these posts but I feel my case is a bit different since it has quite a few moving parts. I've tried various things and I'm still struggling to find a solution, hop...
  • v-xicai's avatar
    v-xicai
    7 years ago

    Hi JM_nxgn ,

     

    You can create measure like DAX below.

     

    Sales = var d= CALCULATE(DISTINCTCOUNT(table[customer_id]), table[issold] = TRUE())
    VAR _table = SUMMARIZE(table, table[Product_ID],"_Value", d)
    RETURN
    IF(HASONEVALUE(table[Product_ID]),d,SUMX(_table,[_Value]))

    Best Regards,

    Amy

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.