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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Dbrunts0888_
Frequent Visitor

DISTINCT COUNT - From Another Table as String

Hi All,

I have been at this for hours and looking thorugh other post's nothing quite works.

 

Hours_Spend_Data - is my data table which contains all weeks worked, hours, charges by site / colleague

Colleague_Tenure - is a new calculated table created to store colleague length of service / weeks worked

Dbrunts0888__0-1646413706875.png

 

I have created the relationship and it works as intended when creating a matrix it shows colleagues and their weeks worked values.

 

However, I need to get those distinct counts added to the Colleague_Tenure lookup so I can add more columns 

e.g. IF > 12 weeks worked "Post Parity", "Pre Parity"

(I have created a weeks worked column to give distinct weekly values as some colleagues have multiple timesheets)

 

I have tried groupby, count, distinct count etc. but nothing is working as I need.

 

If anyone needs more information let me know.

Thanks

Dan

 

Colleague_Tenure

Dbrunts0888__1-1646413819579.png

 

 

Hours_Spend_Data

Dbrunts0888__2-1646413964474.png

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

How about this?

CALCULATE ( DISTINCTCOUNT ( Hours_Spend_Data[Weeks_Worked] ) )

 

View solution in original post

3 REPLIES 3
Dbrunts0888_
Frequent Visitor

I'm 99.9% sure I tried calculate count and calculate distinct count.

 

will triple check in the morning.

Maybe you tried it without CALCULATE. That function needs to be included so that it does a context transition and filters Hours_Spend_Data by the current row rather than calculating the distinct count over the entire table.

AlexisOlson
Super User
Super User

How about this?

CALCULATE ( DISTINCTCOUNT ( Hours_Spend_Data[Weeks_Worked] ) )

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.