Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Max common week

Hello Everyone, How to unify the week numbers and set the number of the last common week for all categories? Below is what some of the data looks like: CATEGORY  WEEK No TOTAL SALES YTD 2021 ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    What's the calculation logic of Max common week? If you have the table with below data, what is Max common week? It is still 13 or other value? Could you please some original data in Table and your expected result with examples? Thank you.

    If Max common week is 12, then you can create a measure as below. Please find the attachment for the details.

     

    Measure =
    VAR _tab =
        SUMMARIZE (
            'Table',
            'Dim Calendar'[Year],
            'Dim Calendar'[No Week],
            "numberofweek",
                CALCULATE (
                    COUNT ( 'Table'[CATEGORY] ),
                    FILTER (
                        ALL ( 'Table' ),
                        YEAR ( 'Table'[DATE] ) = SELECTEDVALUE ( 'Dim Calendar'[Year] )
                            && WEEKNUM ( 'Table'[DATE] ) = SELECTEDVALUE ( 'Dim Calendar'[No Week] )
                    )
                )
        )
    RETURN
        MAXX (
            FILTER ( _tab, [numberofweek] = MAXX ( _tab, [numberofweek] ) ),
            [No Week]
        )

     

    Best Regards