Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
marcl2
Frequent Visitor

Working day: previous year sales not appearing for WD21 of February 2025 ?

Dear gents,

I have an issue with working days and previous year sales!
In a report with the month of February selected, when iI select the year 2024 I have 10.82 on the WD21 and when I select 2025 I see blank or 0 for the WD21 previous year ???...

Has anybody a clue on such a problem? The measures below play with the working day, the month and the year from a date table...

 

2025-02-11 14_56_26-dailysales (5).png2025-02-11 14_57_50-dailysales (5).png

My date table looks like that and we find on 29th Feb 2024 the working day 21
2025-02-11 16_19_46-dailysales (5).png

I know that there is no 29th Feb in 2025 and therefore the working day comes from an extra table 2025-02-11 16_26_43-dailysales (5).png

PYWD and PYWD2 are 2 versions of the same measures, with and without calculate and other changes...

PYWD =

VAR CurrentWD = SELECTEDVALUE(DIM_WorkingDays[WorkingDayNumber])
VAR CurrentYear = SELECTEDVALUE('DIM_Date🕒'[Calendar YearNumber])
VAR CurrentMonth = SELECTEDVALUE('DIM_Date🕒'[Calendar MonthNumber])

RETURN
    CALCULATE(
        [GrossSales_FI],
        FILTER(
            ALL('DIM_Date🕒'),
            'DIM_Date🕒'[Calendar YearNumber] = CurrentYear - 1 &&
            'DIM_Date🕒'[Calendar MonthNumber] = CurrentMonth &&
            'DIM_Date🕒'[Corr Working Day Number] = CurrentWD
        )
    )

PYWD2 =
VAR CurrentWD = SELECTEDVALUE(DIM_WorkingDays[WorkingDayNumber])
VAR CurrentYear = MAX('DIM_Date🕒'[Calendar YearNumber])
VAR CurrentMonth = SELECTEDVALUE('DIM_Date🕒'[Calendar MonthNumber])
VAR SalesLastYear =
    SUMX(
        FILTER(
            ALL('DIM_Date🕒'),
            'DIM_Date🕒'[Calendar YearNumber] = CurrentYear - 1 && 'DIM_Date🕒'[Calendar MonthNumber] = CurrentMonth &&
            'DIM_Date🕒'[Corr Working Day Number] = CurrentWD
        ),
        [GrossSales_FI]
    )

RETURN
    IF(ISBLANK(SalesLastYear), 0, SalesLastYear)  -- Force 0 instead of blank
0 REPLIES 0

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.