Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Good Morning
I am trying to compare a count of a column this month going off working days vs last month's working days.
I used the following community post to get the working day number next to the calendar dates so, for example, this month the 1st working day is the 1st and last month the 1st working day was the 2nd both have a 1 next to them.
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Same-working-day-last-month/m-p/2714230
I can get the counts to show vs the date field but I want this to show against a department without the date fields on the page.
But instead, I would like it
I have joined the calendar table to my data table but I cannot figure out how to only to count the files opened between the first working day and the current working day.
Help would be appreciated
Solved! Go to Solution.
Solved it, if you need this add the following to your calendar table:
WorkdaySort =
VAR _sort =
CALCULATE (
COUNT ( 'Calendar'[Date] ),
FILTER (
'Calendar',
'Calendar'[Month] = EARLIER ( 'Calendar'[Month] )
&& 'Calendar'[Date] <= EARLIER ( 'Calendar'[Date] )
&& 'Calendar'[Year] = EARLIER( 'Calendar'[Year] )
&& NOT 'Calendar'[Day of Week] IN { 5, 6 }
)
)
VAR _result =
IF ( NOT 'Calendar'[Day of Week] IN { 5, 6 }, _sort )
RETURN
_result
Then the following as your measure:
Last Month MTD =
VAR _MINworkday_sort =
CALCULATE ( MIN( 'Calendar'[WorkdaySort] ), 'Calendar'[Date] = EOMONTH(TODAY(),0)+1 )
VAR _MAXworkday_sort =
CALCULATE ( MAX( 'Calendar'[WorkdaySort] ), 'Calendar'[Date] = TODAY() )
return
CALCULATE (
COUNT(Matters[cMatter]),
FILTER (
ALL('Calendar'),
'Calendar'[Year] = YEAR(TODAY())
&& 'Calendar'[Month] = MONTH(TODAY())-1
&& 'Calendar'[WorkdaySort] >= _MINworkday_sort
&& 'Calendar'[WorkdaySort] <= _MAXworkday_sort
)
)
Change the count to your measure or sum or count and it will pull in your last month-to-date working days aggregation.
Solved it, if you need this add the following to your calendar table:
WorkdaySort =
VAR _sort =
CALCULATE (
COUNT ( 'Calendar'[Date] ),
FILTER (
'Calendar',
'Calendar'[Month] = EARLIER ( 'Calendar'[Month] )
&& 'Calendar'[Date] <= EARLIER ( 'Calendar'[Date] )
&& 'Calendar'[Year] = EARLIER( 'Calendar'[Year] )
&& NOT 'Calendar'[Day of Week] IN { 5, 6 }
)
)
VAR _result =
IF ( NOT 'Calendar'[Day of Week] IN { 5, 6 }, _sort )
RETURN
_result
Then the following as your measure:
Last Month MTD =
VAR _MINworkday_sort =
CALCULATE ( MIN( 'Calendar'[WorkdaySort] ), 'Calendar'[Date] = EOMONTH(TODAY(),0)+1 )
VAR _MAXworkday_sort =
CALCULATE ( MAX( 'Calendar'[WorkdaySort] ), 'Calendar'[Date] = TODAY() )
return
CALCULATE (
COUNT(Matters[cMatter]),
FILTER (
ALL('Calendar'),
'Calendar'[Year] = YEAR(TODAY())
&& 'Calendar'[Month] = MONTH(TODAY())-1
&& 'Calendar'[WorkdaySort] >= _MINworkday_sort
&& 'Calendar'[WorkdaySort] <= _MAXworkday_sort
)
)
Change the count to your measure or sum or count and it will pull in your last month-to-date working days aggregation.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
10 | |
10 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |