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

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

Reply
DHB
Helper V
Helper V

Counting Values in a Joined Table

Hi all,

 

could anyone give me an idea how to count rows in a joined table please?

 

I have a table of people (all unique records) joined to a table of dates (each person/date combination is unique) with a one to many relationship.  In the people table I'd like to create a DAX expression (DATE COUNT) which will count the number of dates for that person in the dates table.

 

People

PERSONDATE COUNT
1234_ABC3
1255_ABC1
1234_CDE6
1344_XYZ2
1499_MMM0

 

Dates

PERSONDATE
1234_ABC1/01/2020
1234_ABC2/01/2020
1234_ABC3/01/2020
1255_ABC1/01/2020
1234_CDE1/01/2020
1234_CDE2/01/2020
1234_CDE3/01/2020
1234_CDE4/01/2020
1234_CDE5/01/2020
1234_CDE6/01/2020
1344_XYZ1/01/2020
1344_XYZ2/01/2020

 

Thank you in advance for your help.

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

you need to just use COUNTROWS functions

measure =

COUNTROWS( 'your'table)+0

View solution in original post

6 REPLIES 6
DHB
Helper V
Helper V

@Ahmedx thank you so much for your solution.  How could I change it to only count dates that are "VALID" according to another column?

 

 So if the Dates table now looked like this:

PERSONDATEVALID
1234_ABC1/01/2020VALID
1234_ABC2/01/2020VALID
1234_ABC3/01/2020INVALID
1255_ABC1/01/2020VALID
1234_CDE1/01/2020VALID
1234_CDE2/01/2020VALID
1234_CDE3/01/2020INVALID
1234_CDE4/01/2020INVALID
1234_CDE5/01/2020INVALID
1234_CDE6/01/2020INVALID
1344_XYZ1/01/2020VALID
1344_XYZ2/01/2020VALID

 

 

And the result should now look like this;

PERSONDATE COUNT
1234_ABC2
1255_ABC1
1234_CDE2
1344_XYZ2
1499_MMM0

Hi,

Write this measure

Measure = calculate(countrows(Dates),Dates[Valid]="Valid")

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you @Ashish_Mathur that works well.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
DHB
Helper V
Helper V

Thank you @Ahmedx 

Ahmedx
Super User
Super User

you need to just use COUNTROWS functions

measure =

COUNTROWS( 'your'table)+0

Helpful resources

Announcements
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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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