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
tomekm
Helper III
Helper III

Calculate repeated occurrences in a column with applied date filters

Hi,

 

I'm trying to get a formula that will provide the number of repeated rows in a column, given a filter applied (in my case, it's a period filter). The table looks like the below (period filter in this case is selecting only Aug-2021 and Sep-2021). The last column is the desired output.

 

Thank you.

 

PeriodConcat (master)Count of Concat (master)
Aug-2021A2
Sep-2021A2
Aug-2021B2
Sep-2021B2
Aug-2021C1
Sep-2021D1
Aug-2021E1
Sep-2021F1
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @tomekm ,

 

Try this

Count of Concat (master) =
CALCULATE (
    COUNT ( 'Table'[Concat (master)] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        [Concat (master)] = MAX ( 'Table'[Concat (master)] )
    )
)

 

 

10.png

With the ALLSELECTED function, your results will still be affected by the filter.

11.png

 

If you want the results not to be affected by the filter, you can modify it to

Count of Concat (master) =
CALCULATE (
    COUNT ( 'Table'[Concat (master)] ),
    ALLEXCEPT ( 'Table', 'Table'[Concat (master)] )
)

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @tomekm ,

 

Try this

Count of Concat (master) =
CALCULATE (
    COUNT ( 'Table'[Concat (master)] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        [Concat (master)] = MAX ( 'Table'[Concat (master)] )
    )
)

 

 

10.png

With the ALLSELECTED function, your results will still be affected by the filter.

11.png

 

If you want the results not to be affected by the filter, you can modify it to

Count of Concat (master) =
CALCULATE (
    COUNT ( 'Table'[Concat (master)] ),
    ALLEXCEPT ( 'Table', 'Table'[Concat (master)] )
)

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Greg_Deckler
Community Champion
Community Champion

@tomekm Depending on exactly what you want, this could be something simple like:

Count column =
  VAR __Concat = [Concat (master)]
RETURN
  COUNTROWS(FILTER('Table',[Concat (master)] = __Concat))

Or something complex like a variation on Cthulhu: Cthulhu - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hey Greg,

 

Please see attached. I pasted your formula in my pbi file (last column here), and what I'm getting is the total count of ocurrences but for all the Periods, even though I have selected only 2021-08 and 2021-09 in my filter. Ideally, it would show only a count of 2 for all these rows, since in this case all the Concat (master) values are present both in Aug to Sept.

 

Capture.JPG

 

Thanks.

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.

Top Solution Authors