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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

how to calculate number by distinct text

i have a data that it has duplicted data in it 

Capture.PNG

i want to sum the reruen number without counting duplicated data

So i want the reterun number shows 4(2+2) Instead of 12(2+2+2+2+2+2)

it would be like STR return

                             A      2

                             B     2

So it will shows reterun number shows 4(2+2) Instead of 12(2+2+2+2+2+2)

but ny code isn't working 

sum return =

CALCULATE(SUM(STR_Status[Return ),DISTINCTCOUNT(STR_Status[STR]))
and it shows error "The True/False expression does not specify a column. Each True/False expressions used as a table filter expression must refer to exactly one column."
can someone help me out? thanks 
 
 
1 ACCEPTED SOLUTION

Hi,

 

Try the solution provided in this post below and see if it helps

Sum one column based on unique entries in another column 

View solution in original post

4 REPLIES 4
az38
Community Champion
Community Champion

Hi @Anonymous 

 

try a measure

sum return =
CALCULATE(DISTINCTCOUNT(STR_Status[Return]))

 

or set Aggregation type as Count (Distinct) in visual settings inside Visualization pane

 

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


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

first of all thank you @az38 ,

but i actually simplify the data what i really wnat is make it like this

STR return

A     2

B      2

so it would be 2+2 =4

but in the data it has more like this

STR return

A     2

A     2

A     2

B      1

B      1

B      1

C      2

C       2

C        2

so i want it add like 2+1+2 =5

and i tried use your code but the total number of retrun is way to small. i think becuase it distinc the retrun number so your code works like this 2+1

it didn't add the 2 from STR C

az38
Community Champion
Community Champion

so,  @Anonymous  you can create a calculated table

 

Table = DISTINCT(STR_Status)

 

then just add to visual

423857.png

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


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

Hi,

 

Try the solution provided in this post below and see if it helps

Sum one column based on unique entries in another column 

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