Count left working days in current month

joslaz

Board Regular
Joined
May 24, 2018
Messages
76
Good day everybody,


I am facing a relatively trivial problem, but somehow I can not continue.


Aussprache lernen
I would like to know how (dax measure) many working days are still available in the current business month from today (in Excel/ Power Pivot).



I have the following table:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]B_Month[/TD]
[TD]Workday[/TD]
[/TR]
[TR]
[TD]01.01.2019[/TD]
[TD]Jan[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]02.01.2019[/TD]
[TD]Dec[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]


As you can see, the business month is different from the normal month.

Code:
=VAR CurrentDay = MAX('Calendar'[Date])
VAR CurrentMonth = MAX('Calendar'[B_Month])
RETURN
CALCULATE('Calendar'[Workday];
FILTER(ALL('Calendar'[Date]); 'Calendar'[Date] <= CurrentDay &&
 'Calendar'[B_Month] = CurrentMonth))



I constantly receive only any error messages.


Does somebody has any idea?

Best Regards
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Your CALCULATE doesn't have an operator like SUM(). Assuming all your other logic and relationships are good...
 
Upvote 0
Thanks for your replay!

I have developed the following approach that works:
Code:
=VAR LastDayOfCurrentMonth = MAX('Calendar'[Date])Return
CALCULATE(
    COUNTROWS('Calendar');
    FILTER('Calendar';'Calendar'[Date] >= TODAY() && 'Calendar'[Date] <= LastDayOfCurrentMonth);
    FILTER('Calendar'; 'Calendar'[Workday]>= 0,5))

What do you think?
Are there any potential issues?
 
Upvote 0

Forum statistics

Threads
1,224,743
Messages
6,180,687
Members
452,994
Latest member
Janick

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top