Forum Discussion

Juan_91's avatar
Juan_91
Regular Visitor
3 years ago
Solved

Look for a value filtering by month

Hello, i'm totally new in DAX. Hope you can help me! I don't know what mesure can i do for this example: i have two tables, one of them has 6 different names and the other table has some of the names with the month (like the tables below). I would like to know (making a dynamic table that allows me filter by month) how many times appear the names in, for example, april (in that case only John appears 1 time in April and the others 0 times); or, for example, how many times appear the names in june (in that case John appears 2 times, Tom 1 time, and the others 0 times).

 

Table 1
Names
John
Michael
Jacob
Oliver
Jake
Tom

 

Table 2 
DateNames
AprJohn
MayJohn
MayJohn
JunJohn
JunJohn
JunTom
JulTom
JulJacob
AugJacob

 

Actually the real case is another but this example is a representation of what i would need help. 

Thank you so much for the reply 🙂 I really appreciate it. 

  • hi Juan_91 

    if you need names column from table1, try like:

    measure 1=
    CALCULATE(
    	COUNTROWS(Table2),
    	USERELATIONSHIP(Table1[Names],Table2[Names])
    ) +0

     

    the point is to add +0 in the end. 

     

    it worked like:

     

8 Replies

    • Juan_91's avatar
      Juan_91
      Regular Visitor

      Hi FreemanZ . Thanks for your reply. Actually i'm working with Power Pivot and Excel. And i would like to do a dynamic table in the excel with the data model. I'm looking for a dynamic table like Table 1 but with one more column containing how many times the names repeat in the month selected. I think i should create a measure with the tables, but i don't know what kind of it. 
      Hope i can exlain me well. 

      Thanks again. 

      • FreemanZ's avatar
        FreemanZ
        Icon for Super User rankSuper User

        hi Juan_91 

        you can just create a standard pivot table with slicer, with no measure, like this: