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
ajaydavidluke
Helper I
Helper I

Value for last business/working day

Good afternoon,

 

I am looking to work out a value from the last business day,

i.e. if Monday, look back to Friday etc

So far I have the previous days dax as follows:

Boxes put away previous day =
CALCULATE(
SUM('Stock replenishment records'[Box est v2]),
'Stock replenishment records'[Date] = TODAY() - 1)
 
Can anyone adivse how the dax can calculate and remove weekends to refer to a Friday?
 
Many thansk in advance.....
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ajaydavidluke ,

Please have a try.

Create  columns.

weekday=weekday('table'[date],2)
weeknum=weeknum('table'[date],2)

Then create a measure.

Boxes put away previous day =
VAR _1 =
    CALCULATE (
        SUM ( 'Stock replenishment records'[Box est v2] ),
        'Stock replenishment records'[Date]
            = TODAY () - 1
    )
VAR _value =
    CALCULATE (
        SUM ( 'Stock replenishment records'[Box est v2] ),
        'Stock replenishment records'[Date]
            = TODAY () - 3
    )
RETURN
    IF ( 'table'[weekday] = 1, _value, _1 )

 

If I have misunderstood your meaning, please provide more details withyour desired output and pbix file without privacy infotmaion ( Or some smple data).

 

Best Regards

Community Support Team _ Polly

 

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

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @ajaydavidluke ,

Please have a try.

Create  columns.

weekday=weekday('table'[date],2)
weeknum=weeknum('table'[date],2)

Then create a measure.

Boxes put away previous day =
VAR _1 =
    CALCULATE (
        SUM ( 'Stock replenishment records'[Box est v2] ),
        'Stock replenishment records'[Date]
            = TODAY () - 1
    )
VAR _value =
    CALCULATE (
        SUM ( 'Stock replenishment records'[Box est v2] ),
        'Stock replenishment records'[Date]
            = TODAY () - 3
    )
RETURN
    IF ( 'table'[weekday] = 1, _value, _1 )

 

If I have misunderstood your meaning, please provide more details withyour desired output and pbix file without privacy infotmaion ( Or some smple data).

 

Best Regards

Community Support Team _ Polly

 

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

 

Good morning,

 

I have followed your suggestion but I receive the following error:

ajaydavidluke_2-1663659078590.png

 

 

ajaydavidluke_1-1663659040551.png

 

 

Anonymous
Not applicable

Hi @ajaydavidluke ,

My fault, I forgot it was a measure and not a column. Please modify the measure again.

Boxes put away previous day =
VAR _1 =
    CALCULATE (
        SUM ( 'Stock replenishment records'[Box est v2] ),
        'Stock replenishment records'[Date]
            = TODAY () - 1
    )
VAR _value =
    CALCULATE (
        SUM ( 'Stock replenishment records'[Box est v2] ),
        'Stock replenishment records'[Date]
            = TODAY () - 3
    )
RETURN
    IF ( max('table'[weekday] )= 1, _value, _1 )

 

Best Regards

Community Support Team _ Polly

 

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

 

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.