Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Week Number parameters

Hi,   I'm working on a weekly production plan, I created a date table with the week numbers (Formula: Weeknum) My working week starts on Sunday and ends on Saturday.   There are weeks that are s...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Thank you tamerj1  for your reponse.

    just one detail ,how I can convert "Slicer Month" to a Date Format, now it is a Text ?

  • tamerj1's avatar
    tamerj1
    4 years ago

    Hi Anonymous 
    Create another column (Slicer Month Number) and then use the option sort by column to sort the Slicer Month by the Slicer Month Number

    Slicer Month = 
    VAR CurrentMonth = 'Date'[Month Number]
    VAR CurrentYearWeekTable =
        FILTER (
            CALCULATETABLE ( 'Date', ALLEXCEPT ( 'Date', 'Date'[Year], 'Date'[Week Number] ) ),
            'Date'[Month Number] = CurrentMonth
        )
    VAR MaxWeekday = 
        MAXX ( CurrentYearWeekTable, WEEKDAY ( 'Date'[Date], 1 ) )
    VAR MonthNumber =
        IF (
            MaxWeekday < 3, 
            CurrentMonth + 1,
            CurrentMonth
        )
    RETURN
        MonthNumber