Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I have a sales column with everyday sales. I want to move the weekend sales to the closest working day in the current month.
For example:
if saturday and sunday sales are in the same month, the sales should be added to the previous friday sales.
if 30th november sales is on saturday, i want the sales to be added to 29th of november which is friday. if 1st december sales is on sunday, i want the sales to be added to 2nd december which is monday. so ideally, weekend sales should be added to the closest working day in the same month. I hope its clear.
Adjusted sales measure:
Adjusted Sales =SUMX(VALUES('Date'[Date]), CALCULATE(
SUM('Actual Sales'[Sales(MT)]),
TREATAS(VALUES('Date'[ClosestWorkingDay]),
'Actual Sales'[Date_Date])))
Expected result in the adjusted sales column in table:
2/12/2024 = sales from 1st dec(sunday) + 2nd dec(monday)(169.49 + 6.85)
29/11/2024 = sales from 29th nov(friday) + 30 th nov(saturday)(102.87 + 32.87)
weekend rows should be empty and added to the closest working day.
I hope i have been clear. Any help is much appreciated.
Solved! Go to Solution.
Hi @Shravan133 ,
please try below, please find attached pbix for your reference
https://drive.google.com/file/d/1nonw7bT7MSLTQ-Ai63ka4t6BP3Z05ESz/view?usp=drive_link
Hi @Shravan133 ,
please try below, please find attached pbix for your reference
https://drive.google.com/file/d/1nonw7bT7MSLTQ-Ai63ka4t6BP3Z05ESz/view?usp=drive_link
Hi @Shravan133 ,
we haven't heard back from you regarding our last response and wanted to check if your issue has been resolved.
If our response addressed your query, please mark it as Accept Answer and click Yes if you found it helpful.
Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!
Hi @Shravan133
We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet.
In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.
Hi @Shravan133
we haven't heard back from you regarding our last response and wanted to check if your issue has been resolved.
If our response addressed your query, please mark it as Accept Answer and click Yes if you found it helpful.
Should you have any further questions, feel free to reach out.
Thank you for being a part of the Microsoft Fabric Community Forum!
Dear Shravan133
You can add the closest working date as a calculated column to your fact table 'Actual Sales':
ClosestWorkingDay =
VAR _weekday =
WEEKDAY ( 'ActualSales'[Date] )
VAR _adjustDay =
IF (
_weekday = 7,
IF ( MONTH ( 'ActualSales'[Date] ) = MONTH ( 'ActualSales'[Date] - 1 ), -1, 2 ),
IF (
_weekday = 1,
IF ( MONTH ( 'ActualSales'[Date] ) = MONTH ( 'ActualSales'[Date] + 1 ), 1, -2 ),
0
)
)
RETURN
DATEADD ( 'ActualSales'[Date], _adjustDay, DAY )
Then you could add an inactive relationship between your date table and the new column ClosestWorkingDay and calculate the new measure:
AdjustedSales =
CALCULATE (
SUM ( ActualSales[Sales(MT)] ),
USERELATIONSHIP ( ActualSales[ClosestWorkingDay], 'Date'[Date] )
)
or if [ClosestWorkingDay] is in the 'Date' table, the inactive relationship is between 'Date'[ClosestWorkingDay] and Actual Sales'[Date] and the measure is
AdjustedSales =
CALCULATE (
SUM ( ActualSales[Sales(MT)] ),
USERELATIONSHIP ( 'Date'[ClosestWorkingDay], 'Actual Sales'[Date] )
)
Or you calculate the measure without a new relationship like:
AdjustedSales =
VAR _selectedDates =
VALUES ( 'Date'[Date] )
RETURN
CALCULATE (
SUM ( ActualSales[Sales(MT)] ),
ActualSales[ClosestWorkingDay] IN _selectedDates,
REMOVEFILTERS ( 'Date' )
)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |