Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Dax DisctinctCount with date condition

So here is my problem, i need to calculate the quantity of different "DOC Number" but only if the Register date is < than Sales Date, in this case the "DOC NUMBER" repeats because it might be 2 diffe...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi v-xicai jdbuchanan71 

     

    i've tryed both the solutions you guys gave, sadly idk why it didnt work so what i did to make it work is to create a columm in the Sales Tables called "Register Date" with this fucntion 

     

    RegisterDate= Related('MembershipTable'[Registerdate]

     

    with this and the a mix of the measure i used at the beginning and parts of yours it worked 

     

    Tickets = CALCULATE(DISTINCTCOUNT('SalesTable'[DOC Number]),FILTER('SalesTable','MembershipTable'[RegisterDate]<='SalesTable'[SalesDate]))
     
    Thanks a lot for your solutions 3 minds think better than 1 :)