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 find repeated values over consecutive weeks?

Hi!

 

I have different categories, labeled as 'PICKER BEHAVIOUR CLASS', these categories have a group of IDs, and there's a quantity of IDs that match these categories every week. For Example, the IDs 1, 2 and 3 in February 7th fell into this category,  then the next week, February 14th, the IDs 1 and 2 fell into this category again. What I want to know is if there's a way I can count how many IDs repeated category. In this case, for the week of February 14th, the result should be 2. 

 

I expect something like these to be the result. 

luis_murilo_0-1652365291842.png

Can anybody please help me?

 

Best Regards

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please refer the formula.

count_ =
VAR tmp =
    CALCULATETABLE (
        VALUES ( 'Table'[id] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[category] = SELECTEDVALUE ( 'Table'[category] )
                && 'Table'[week]
                    = SELECTEDVALUE ( 'Table'[week] ) - 1
        )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[id] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[week], 'Table'[category] ),
            'Table'[id] IN tmp
        )
    )

vjaywmsft_1-1652775015935.png

 

Best Regards,

Jay

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Please refer the formula.

count_ =
VAR tmp =
    CALCULATETABLE (
        VALUES ( 'Table'[id] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[category] = SELECTEDVALUE ( 'Table'[category] )
                && 'Table'[week]
                    = SELECTEDVALUE ( 'Table'[week] ) - 1
        )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[id] ),
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[week], 'Table'[category] ),
            'Table'[id] IN tmp
        )
    )

vjaywmsft_1-1652775015935.png

 

Best Regards,

Jay

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

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