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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Moni
New Member

To calculate distinctcount date with text type

I gotta column with weekending dates and another coulumn with full name, so im trying use DAX to calculate distinct value of each full name with no of weeks, 

 

I'm getting error with full name as text type cannot be used as true/false or text type cannot be used in filter with distinct count.

 

can anyone help me please.

Moni_0-1652778519208.png

 

I want output to be gareth 2 weeks, Darran 1 week (since 12/11/21 repeating so distinct count)

1 ACCEPTED SOLUTION
SpartaBI
Community Champion
Community Champion

@Moni just to be sure, you put 'Table[Full Name] on rows of the matrix and created this measure:
Distinct Weeks Measure = DISTINCTCOUNT('Table'[Week Ending]) 
And put that measure on the values and it didn't work?

View solution in original post

7 REPLIES 7
SpartaBI
Community Champion
Community Champion

@Moni just to be sure, you put 'Table[Full Name] on rows of the matrix and created this measure:
Distinct Weeks Measure = DISTINCTCOUNT('Table'[Week Ending]) 
And put that measure on the values and it didn't work?

Hi @SpartaBI 

I tried those measures, it calculates distinctcount of weekending but not name, example it shows

 

Darren 7 weeks

Gareth 2 weeks

 

but i expect answer,

 

Daren 2 weeks (since 12/11/2021, 19/11/2021 only two days are ter)

Hi @Moni ,

Adding name and distinct count of week ending gives me 2 weeks for both persons.

rohit_singh_0-1652780384076.png


Not sure what exactly your expected output is?


Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊

Hi @rohit_singh 

 

I tried, changing count and everything

I tried those measures, it calculates distinctcount of weekending but not name, example it shows

 

Darren 7 weeks

Gareth 2 weeks

 

but i expect answer,

 

Daren 2 weeks (since 12/11/2021, 19/11/2021 only two days are ter)

SpartaBI
Community Champion
Community Champion

@Moni maybe these values are not really unique in the data. How did you created this column? Do you have maybe a sample data you can share?

Hi @SpartaBI 

 

Example

Moni 12/1/2020

yuvi   1/3/2021

Moni 12/1/2020

yuvi    1/3/2021

 

Distinctcount(table(weekending)) 

showing Moni 2 weeks

Yuvi 2 weeks

 

but what I expect is Moni 1 week

Yuvi 1 week

SpartaBI
Community Champion
Community Champion

Hey @Moni I saw now you acceted my solution. Making sure it was solved cause this is the last reply you wrote to me.

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.

Top Solution Authors
Top Kudoed Authors