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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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