Forum Discussion

erhan_79's avatar
erhan_79
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

Last Day calculating

Hi there ;   I need your support for below issue , i have table visual and month filter slicer as below .Every month ,  4 times in a month i am uploading as below infos date , material and quantiti...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi erhan_79 

    I update my Slicer Table , Fact Table and measure.

    New Fact Table:

    Add WeekNum and YearMonth column.

    WeekNum = WEEKNUM('Table'[Date],2)
    YearMonth = YEAR('Table'[Date])*100+MONTH('Table'[Date])

    Slicer Table:

    Add a YearMonth column than before.

    Measure:

    Measure = 
    VAR _SelectYearMonth = VALUES('YearMonthFilter'[YearMonth])
    VAR _LastWeek = MAXX(FILTER(ALL('Table'),'Table'[YearMonth]=MAX('Table'[YearMonth])&&'Table'[YearMonth]IN _SelectYearMonth),'Table'[WeekNum])
    Return
    IF(ISFILTERED(YearMonthFilter[MonthName]),IF(MAX('Table'[YearMonth]) IN _SelectYearMonth&&MAX('Table'[WeekNum]) = _LastWeek,1,0))

    Result is as below.

    By default it will show blank.

    Select 2021 January.

    Select 2021 Jan and 2022 Feb:

     

    Best Regards,

    Rico Zhou

     

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