March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
12-11-2024 21:13 PM
Solution:
There is a solution like creating a new date column and moving weekend to Monday or Friday and join the new column with the date.
But we would like to have a solution using only measures. This means we need to move weekend data by 1–2 days on either side
Columns I already have in the Model
Discount = [Gross Sales]*[Dis Per]/100.0
Gross Sales = [Qty] * [Price]
Net Sales = [Gross Sales] - [Discount]
Measure I am using
Net = Sum(Sales[Net Sales])
New measures created for weekend data moved to Monday
Net non Work = CALCULATE([net] , filter('Date', WEEKDAY('Date'[Date],2) >=6 ))
Net non work 1 = CALCULATE(CALCULATE([net] , filter('Date', WEEKDAY('Date'[Date],2) =6 )) , dateadd('Date'[Date],-2,DAY)) + CALCULATE(CALCULATE([net] , filter('Date', WEEKDAY('Date'[Date],2) =7 )) , dateadd('Date'[Date],-1,DAY))
Net Work = CALCULATE([net] , filter('Date', WEEKDAY('Date'[Date],2) <6 ))
Net Show on Monday = [Net Work] + [Net non work 1]
New measures created for Friday
Net non work b 1 = CALCULATE(CALCULATE([net] , filter('Date', WEEKDAY('Date'[Date],2) =6 )) , dateadd('Date'[Date],1,DAY)) + CALCULATE(CALCULATE([net] , filter('Date', WEEKDAY('Date'[Date],2) =7 )) , dateadd('Date'[Date],2,DAY))
Net Show on Friday = [Net Work] + [Net non work b 1]
Find more details on the Blog
How can i handle crossing months? 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.