cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
raeesgillani Frequent Visitor
Frequent Visitor

NETWORKDAYS inside PowerBI

There are two columns, Void Start and Due Date, I would like to work out the number of working days between the two days.

I've tried to use the following formula shown here (by @Greg_Deckler ), but I can't seem to get it to work.

This is the code for my situation (created it as a measure):

NetWorkDays = 
VAR Calendar1 = CALENDAR(MAX('Voids Data'[Void Start]),MAX('Voids Data'[Due Date (corrected)]))
VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekDay",WEEKDAY([Date],2))
RETURN COUNTX(FILTER(Calendar2,[WeekDay]<6),[Date])


It's accepted by PowerBI, but when I throw it into a table visualisation (this visualisation has two columns, one is void start date, the other is due date), I get the following error:



https://imgur.com/a/eCWRH4P
Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
raeesgillani Frequent Visitor
Frequent Visitor

Re: NETWORKDAYS inside PowerBI

So I kept playing around with different solutions but the original solution provided by @Greg_Deckler seemed to work once I removed null values from my data and then made the extreme values zero:

VAR Calendar1 = CALENDAR(MIN('Voids Data'[Start]),MIN('Voids Data'[End]))
VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekDay",WEEKDAY([Date],2))
RETURN IF(COUNTX(FILTER(Calendar2,[WeekDay]<6),[Date])>1000,0,COUNTX(FILTER(Calendar2,[WeekDay]<6),[Date]))

View solution in original post

3 REPLIES 3
raeesgillani Frequent Visitor
Frequent Visitor

Re: NETWORKDAYS inside PowerBI

So I kept playing around with different solutions but the original solution provided by @Greg_Deckler seemed to work once I removed null values from my data and then made the extreme values zero:

VAR Calendar1 = CALENDAR(MIN('Voids Data'[Start]),MIN('Voids Data'[End]))
VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekDay",WEEKDAY([Date],2))
RETURN IF(COUNTX(FILTER(Calendar2,[WeekDay]<6),[Date])>1000,0,COUNTX(FILTER(Calendar2,[WeekDay]<6),[Date]))

View solution in original post

Community Support Team
Community Support Team

Re: NETWORKDAYS inside PowerBI

Hi raeesgillani,

Could you please tell us if your problem has been solved? If you have any problem, please feel free to tell me.

Best Regards,

Teige

raeesgillani Frequent Visitor
Frequent Visitor

Re: NETWORKDAYS inside PowerBI

Yes the issue was resolved, thank you for the check 🙂

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 380 members 3,943 guests
Please welcome our newest community members: