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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Need help to get DistinctCount of ColumnB (ServiceVisitYr) based on ColumnA (ServiceAddress)

Need help to get DistinctCount of ColumnB (ServiceVisitYr) based on ColumnA (ServiceAddress)

 

ServiceAddressServiceVisitYr
A12017
A12017
A12018
A12019
A12019
A22017
A22019
A32017
A32017
A32019
A42019
A42019
A52018

 

 

Expected Result

 

ServiceAddressServiceVisitYrDistinctYrs
A120173
A120173
A120183
A120193
A120193
A220172
A220192
A320172
A320172
A320192
A420191
A420191
A52018

1

 

 

Thanks for your help in advance.

2 REPLIES 2
Mariusz
Community Champion
Community Champion

HI @Anonymous 

 

You can create a measure like.

Measure = CALCULATE(
    DISTINCTCOUNT( 'Table'[ServiceVisitYr] ),
    ALL( 'Table'[ServiceVisitYr] )
)

or column like this.

Column = 
CALCULATE(
    DISTINCTCOUNT( 'Table'[ServiceVisitYr] ),
    ALL( 'Table'[ServiceVisitYr] )
)
Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Anonymous
Not applicable

Thanks for your answer.

 

Your solution works in the data set presented above.

 

but, I have other columns in my table and to make it work I used

 

CALCULATE(DISTINCTCOUNT('Table'[ServiceVisitYr]), ALLEXCEPT('Table','Table'[ServiceAddress]))
 

The other problem is I'm using slicer on 

ServiceVisitYr
and when I filter data I do not get correct count

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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