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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
ghost10
Frequent Visitor

Retrieve previous day values excluding weekends and holidays

Hi All,

 

I would need some direction on Additional logic on retrieving previous value. Requirement is to exclude Weekends and holidays  bring Friday Value over to Monday as Prev Value .

I already have weekend and holidays column as weekend_ind and holidays_ind.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ghost10,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

To calculate the previous date values, you can try to use the following measure formulas:

 

formula =
VAR currDate =
    MAX ( Table[Date] )
VAR holidayList =
    VALUES ( Holiday[Date] )
VAR prevDate =
    CALCULATE (
        MAX ( Table[Date] ),
        FILTER (
            ALLSELECTED ( Table ),
            [Date] < currDate
                && WEEKDAY ( [Date], 2 ) <= 5
                && NOT ( [Date] IN holidayList )
        ),
        VALUES ( Table[Category] )
    )
RETURN
    CALCULATE (
        SUM ( Table[Value] ),
        FILTER ( ALLSELECTED ( Table ), [Date] = prevDate ),
        VALUES ( Table[Category] )
    )

 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @ghost10,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

To calculate the previous date values, you can try to use the following measure formulas:

 

formula =
VAR currDate =
    MAX ( Table[Date] )
VAR holidayList =
    VALUES ( Holiday[Date] )
VAR prevDate =
    CALCULATE (
        MAX ( Table[Date] ),
        FILTER (
            ALLSELECTED ( Table ),
            [Date] < currDate
                && WEEKDAY ( [Date], 2 ) <= 5
                && NOT ( [Date] IN holidayList )
        ),
        VALUES ( Table[Category] )
    )
RETURN
    CALCULATE (
        SUM ( Table[Value] ),
        FILTER ( ALLSELECTED ( Table ), [Date] = prevDate ),
        VALUES ( Table[Category] )
    )

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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