cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper V

## Same Sales last year as per working days

Hello,
I calculated working days with the below formula.

Working Day Outcome Column =
VAR __Date = 'Invoice Date'[InvoiceDate]
VAR __WeekDay = WEEKDAY(__Date,2)
VAR __MonthStart = DATE(YEAR(__Date),MONTH(__Date),1)
VAR __NetWorkDays = NETWORKDAYS(__MonthStart, __Date)
RETURN
IF(__WeekDay < 6, __NetWorkDays,BLANK())

It is working perfectly fine. Now I want to calculate sales for same period last year based on these working days like if 1st working day of october 2022 is 3000 then what would be of 1st working day of October 2021. I was using sameperiodlastyear butit takes date instead if day. How can I use these working days as comparison, Your help would be highly appreciated.
Thank you

1 ACCEPTED SOLUTION
Community Support

Hi @Junaid11 ,

You can try this method:

I create two tables as the sample data:

In the Invoice Data table, new some columns:

``Sales = CALCULATE(SUM(Sales[Sales]), FILTER('Sales','Sales'[Date] = 'Invoice Date'[InvoiceDate]))``
``Month = MONTH('Invoice Date'[InvoiceDate])``
``Year = YEAR('Invoice Date'[InvoiceDate])``
``````LastYearWorkDaySales =
CALCULATE (
SUM ( 'Invoice Date'[Sales] ),
FILTER (
'Invoice Date',
'Invoice Date'[Month] = EARLIER ( 'Invoice Date'[Month] )
&& 'Invoice Date'[Year]
= EARLIER ( 'Invoice Date'[Year] ) - 1
&& 'Invoice Date'[Working Day Outcome Column]
= EARLIER ( 'Invoice Date'[Working Day Outcome Column] )
&& NOT ( ISBLANK ( 'Invoice Date'[Working Day Outcome Column] ) )
)
)
``````

The result is:

Hope this helps you.

Here is my PBIX file.

Best Regards,

Community Support Team _Yinliw

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

2 REPLIES 2
Community Support

Hi @Junaid11 ,

You can try this method:

I create two tables as the sample data:

In the Invoice Data table, new some columns:

``Sales = CALCULATE(SUM(Sales[Sales]), FILTER('Sales','Sales'[Date] = 'Invoice Date'[InvoiceDate]))``
``Month = MONTH('Invoice Date'[InvoiceDate])``
``Year = YEAR('Invoice Date'[InvoiceDate])``
``````LastYearWorkDaySales =
CALCULATE (
SUM ( 'Invoice Date'[Sales] ),
FILTER (
'Invoice Date',
'Invoice Date'[Month] = EARLIER ( 'Invoice Date'[Month] )
&& 'Invoice Date'[Year]
= EARLIER ( 'Invoice Date'[Year] ) - 1
&& 'Invoice Date'[Working Day Outcome Column]
= EARLIER ( 'Invoice Date'[Working Day Outcome Column] )
&& NOT ( ISBLANK ( 'Invoice Date'[Working Day Outcome Column] ) )
)
)
``````

The result is:

Hope this helps you.

Here is my PBIX file.

Best Regards,

Community Support Team _Yinliw

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

Super User

@Junaid11 You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors