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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

Distinct count

I am trying to return distinct count from my table using sysdate- 30 and 60 and 90 days in three different measure. Can someone advise me the easy way to achieve this?

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

hi @Anonymous 

try

Measure90 = CALCULATE(DISTINCTCOUNT(Table1[Column1]);ALL(Table1);Table1[Date]>=(Today()-90))
Measure60 = CALCULATE(DISTINCTCOUNT(Table1[Column1]);ALL(Table1);Table1[Date]>=(Today()-60))
Measure30 = CALCULATE(DISTINCTCOUNT(Table1[Column1]);ALL(Table1);Table1[Date]>=(Today()-30))

do not hesitate to give a kudo to useful posts and mark solutions as solution
Linkedin


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

3 REPLIES 3
az38
Community Champion
Community Champion

hi @Anonymous 

try

Measure90 = CALCULATE(DISTINCTCOUNT(Table1[Column1]);ALL(Table1);Table1[Date]>=(Today()-90))
Measure60 = CALCULATE(DISTINCTCOUNT(Table1[Column1]);ALL(Table1);Table1[Date]>=(Today()-60))
Measure30 = CALCULATE(DISTINCTCOUNT(Table1[Column1]);ALL(Table1);Table1[Date]>=(Today()-30))

do not hesitate to give a kudo to useful posts and mark solutions as solution
Linkedin


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38what if i have to filter this further? for example;

 

Date              RJC#   ACP#

1/3/2019         0         1

1/3/2019         1         0

1/2/2019         0         1

1/2/2019         1         0

1/2/2019         1         0

1/1/2019         0         1

1/1/2019         1         0

1/1/2019         1         0

1/1/2019         1         0

 

Keeping the earlier 30, 60 90 days in filters, what we want to find out id the count of one RJC: for every date within last 30, 60 90 days, we need to count RJC# where RJC# for a given date should be less than or equal to 1. 

 

for 1/1/2019, RJC# is 3 and 4th one is ACP# so it should be treated as 0. Where as for 1/3/2019, RJC# is 1 so it should be treated as 1.

 

Pls advise.

Anonymous
Not applicable

That was apt. Thanks a ton.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.