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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
cottrera
Post Prodigy
Post Prodigy

Distinct Count Buckets

Hi 

 

I have a facts table that has the following columns - Property Ref, Score and Measure. Each property ref has exactly 8 measures each with scores. 

 

Property RefSCOREMeasure
180Arrears
180Damp & Mould
180Damp related health issues
180Guttering
180Pest Control
180Plumbing
1850Job Volume
18100Vulnerable
1851330Guttering
1851330Pest Control
18513325Plumbing
18513375Damp & Mould
18513350Arrears
18513325Damp related health issues
18513325Job Volume
1851330Vulnerable
2843150Damp & Mould
2843150Damp related health issues
2843150Guttering
2843150Pest Control
2843150Plumbing
284315100Arrears
284315100Job Volume
284315100Vulnerable
20850Arrears
208100Damp & Mould
208100Damp related health issues
208100Pest Control
208100Plumbing
208100Guttering
208100Job Volume
208100Vulnerable

 

I also have a buckets table with no relationship to the facts table

OrderFromToCategory 
1400650CAT 4
2300385CAT 3
3200285CAT 2
40185CAT 1

 

I would Like to create a DAX function SUMS the total score per property ref and then counts the distinct property ref that have a total score that matches between the From and To value of my bucket table.

 

For example, i would exspect the see a result similar to this..

Category Distinct Property Count 
CAT 16,403
CAT 22,984
CAT 31,363
CAT 4121

 

 

thank you Richard

1 ACCEPTED SOLUTION
AntonioM
Solution Sage
Solution Sage

Hi, 

 

I think this should work for you

Distinct Property Count =
var _scores = SUMMARIZE(Fact_Table,Fact_Table[Property Ref], "Score", SUM(Fact_Table[SCORE]))
var _count = SUMX(_scores, IF([Score] <= SELECTEDVALUE(Buckets_Table[To]) && [Score] >= SELECTEDVALUE(Buckets_Table[From]),1))
return _count  

AntonioM_2-1659601914319.png

 

 

View solution in original post

2 REPLIES 2
cottrera
Post Prodigy
Post Prodigy

Thank you AntonioM for your quick response the measure worked fine 😁

AntonioM
Solution Sage
Solution Sage

Hi, 

 

I think this should work for you

Distinct Property Count =
var _scores = SUMMARIZE(Fact_Table,Fact_Table[Property Ref], "Score", SUM(Fact_Table[SCORE]))
var _count = SUMX(_scores, IF([Score] <= SELECTEDVALUE(Buckets_Table[To]) && [Score] >= SELECTEDVALUE(Buckets_Table[From]),1))
return _count  

AntonioM_2-1659601914319.png

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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