Forum Discussion

rgalvez's avatar
rgalvez
Frequent Visitor
5 years ago
Solved

New column counting values from two different tables

Hello, This is my fitst post, I hope I can get the help I need. This is my case:   I have Table Enrollments linked to Quiz and to Excersise. Type A or B define whether the user did a Quiz (A) or a...
  • v-deddai1-msft's avatar
    5 years ago

    Hi rgalvez ,

     

    You can create the following calculated column:

     

    Attempts = SWITCH(Enrollments[Type],"A",CALCULATE(COUNTROWS(Quiz),FILTER(Quiz,Quiz[UserID] = EARLIER(Enrollments[UserID]))),"B",CALCULATE(COUNTROWS(Excersise),FILTER(Excersise,Excersise[UserID] = EARLIER(Enrollments[UserID]))))+0

     

     

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

     

    Best Regards,

    Dedmon Dai