Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Juan_91
Regular Visitor

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. 

1 ACCEPTED SOLUTION

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:

FreemanZ_0-1677850518764.png

 

View solution in original post

8 REPLIES 8
FreemanZ
Super User
Super User

hi @Juan_91 

 

try to plot a matrix visual like:

FreemanZ_0-1677811533397.png

 

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. 

hi @Juan_91 

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

FreemanZ_0-1677846327613.pngFreemanZ_1-1677846377667.png

 

Yes! is that an option. But i have another problem. I have an inactive relationship between the two tables. Is possible to do that but keeping the inactive relationship?

hi @Juan_91 

everything is from Table2, so it has nothing to do or no impact to the relationship with anything.

Hi! Ah you do it only with table 2. I would need also table 1 because i would like to know the names that don't appear. If i do an active relationship i can do it, because the dynamic table can show me all the names of table if i want. But in my example i have an inactive relationship 😞 and i don't want to change 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:

FreemanZ_0-1677850518764.png

 

Oh yes that works very well in that case! But i had one more problem 😬. Sory😅! I think we are very close.

My table 1 have also dates (like below); and both table 1 and table 2 have an active relationship with a calendar table (that i want to use it for the filter). So, when i do your measure and then filter by date with the calendar table it takes me the dates of table 1 (i don't need that dates)
If i want i can take the dates of table 2 to filter and works very well! But i would like to take the date of the calendar date. 

I promise the next time i will be more clearer. 

 

Table 1
DateNames
JanJohn
JanMichael
JanJacob
FebOliver
FebJake
FebTom

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.