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

Count the number of times data appears in a table, with a filter on

I have a large data set which counts the amount of times a person has donated to an organisation. 

 

For instance it will look like the below 

 

ID         AmountPayment Type
1089747 £45.00Legacy
2937745£300.00Pledge
038437£500.00Plege

2032896

£300.00New Donor
2937745£40.00Cash Gift

 

I need a DAX count that counts how many times the ID appears, for instance more than once, twice, three times or more, however, I want to filter this further by New donors and everything else such as cash gift, pledge etc. 

 

I have the current DAX formula that is counting those that have donated more than once. However, would like a further measure to put these into groups of donated more than once, twice, three times or more. Then filter the measure by who is a new donor or not. 

Count of Donors duplicates =
VAR _CountbyDonor =
ADDCOLUMNS (
SUMMARIZE ( 'Query1', 'Query1'[CnBio_ID] ),
"@Count", CALCULATE ( DISTINCTCOUNT ( 'Query1'[Amount] ) )
)
VAR _GreaterThan1 =
FILTER ( _CountbyDonor, [@Count] > 1 )
VAR _Result =
COUNTROWS ( _GreaterThan1 )
RETURN
_Result
 
I hope this makes sense.
5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous ,

 

You could create a count measure:

_count = calculate(count(ID),FILTER(ALLESELCTED('Table'),[payment type] = selectedvalue([payment type])&&[ID] = selectedvalue([ID])))

Then create another measure to check who is a new donor or not:

measure = swtich(ture(),
[_count]=1,"New",
[_count]=2,"twice",
[_count]=3,"three times",
[_count]>3,"more then three times"
)

 

Best Regards,

Jay

Anonymous
Not applicable

It's flagging up an error saying " column cannot be used in expression.

Anonymous
Not applicable

Hi @Anonymous ,

 

Which formula show the error?

Both above formulas are measures.

Please share the screenshot.

 

Best Regards,

Jay

amitchandak
Super User
Super User

@Anonymous , Are you trying to have a frequency as column or bucket, you need following for dynamic segmentation 

 

example

Bucket/Segment code
measure
Measure = Count(Table[id]) // you measure

 

new Table // to map frequency with column 
bucket = Generateseries(1,100,1)

 

new Measure // values have group by  on which we take frequency, Id in your case
Countx(filter(Values(Table[ID]), [Measure ] = max(bucket[Value])), [User])

 

 

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1387187#M626


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

For the first part you've put //your measure, is it the measure I put in the initial question?

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.