cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
mespiritu1
Regular Visitor

DAX Query to exclude Saturdays and Sundays depending on condition in counting of ageing

I have this DAX query where in:
If 'WeekendBanking' column is blank/empty, exclude saturdays and sundays (based on networkdays function),
else exclude only Sunday.

 

 

NetworkDays =
VAR IsWeekendBanking = NOT(ISBLANK('Branch Daily Certification - Test'[WeekendBanking]))
VAR ToBeSubmittedDate = 'Branch Daily Certification - Test'[forDate]
VAR SubmittedDate = 'Branch Daily Certification - Test'[dateSubmitted2]

RETURN
IF(
    ISBLANK(ToBeSubmittedDate) || ISBLANK(SubmittedDate),
    BLANK(),
    IF(
        ISBLANK(IsWeekendBanking),
        NETWORKDAYS(ToBeSubmittedDate, SubmittedDate, 11),  -- Exclude only Sundays
        NETWORKDAYS(ToBeSubmittedDate, SubmittedDate, 1)  -- Exclude both Saturdays and Sundays
    )
)

 

 

 

 

This is the output:
mespiritu1_1-1695010688698.png

 

 

As you can see, if the Branch has a weekend banking, the ageing is correct- it excludes only Sundays.
But if it doesn't, I'm not so sure. For example, for the Sen. Gil Puyat branch (the very last item), the forDate is 08/30 and dateSubmitted is 08/31. Shouldn't be the NetworkDays (Ageing) be 1? Or is it really 2 (correct)



Thanks for the help.

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @mespiritu1 

 

You can try the following methods.

Column = IF([WeekendBanking]=BLANK(),NETWORKDAYS([forDate],[dateSubmitted2],1),NETWORKDAYS([forDate],[dateSubmitted2],11))

vzhangti_0-1695277104575.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @mespiritu1 

 

You can try the following methods.

Column = IF([WeekendBanking]=BLANK(),NETWORKDAYS([forDate],[dateSubmitted2],1),NETWORKDAYS([forDate],[dateSubmitted2],11))

vzhangti_0-1695277104575.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors