Power BI-Move on to the next working day - powerbi

How can I use the Weekday formulae in powerBI?
The objective is if the current day is Saturday add 2 days to make it Monday(next working day) and if the current day is Sunday add 1 day to make it Monday and if its friday then add 3 days to make it the next working day.

Related

How to make the relative week filter to include date starting from Sunday?

When using the relative date filter suppose I select last 2 calendar week, assuming today is a Tuesday then it selects Last to last Sunday to Last Saturday.
Where as if I select last 2 week, then it selects Last to last Wednesday to today (Tuesday). How to make the filter select Last to last Sunday to today?
What you are describing can be achieved with a standard date slider. This isn't possible with a relative date filter.

Power Bi DAX: Total for the month

I need to make a total for each of the months based on the working days.
So far i have working days set as 1 if the day in the month is during Monday - Friday and 0 for Saturday and Sunday. I now need to total up the 1's and make it so that it is a single value for the month.
E.g Going the weekdays is 1 and weekend is 0, January will have 22 days on each row on the table in the data mode - January 1 = 232 January 2 = 22 etc. so i can use it to divide against my target which is set to the 1st of every month.
How can i do this??
try this. i haven't tested it.
=GROUPBY( FILTER(table, table[Working_Day]=1) , table[Month], ["new col", SUMX( CURRENTGROUP(), table[Month_Order])])
filter gives working day 1's data as table,then group by performed by month, then month order has been added and returns table.

Previous Week Measure - Week 52 2019 and Week 1 2020

I currently use the below measure to retrieve a value for the previous week, however as it's now week 1 of a new year, the field is returning "blank" as it cannot find any previous weeks.
How would I adapt my measure to include something along the lines of... if week 1 use the last week of the previous year, if not use the previous week.
VAR CURRENT_WEEK = WEEKNUM(TODAY()) return
CALCULATE(AVERAGE(DATA_TABLE[VALUE]),
FILTER (DATA_TABLE, WEEKNUM(DATA_TABLE[DATE]) = CURRENT_WEEK -1))
Thanks in advance for your help
I would suggest using a start date and calculating the weeknum from that date. For example, if you choose 1 Jan 2018 as start date, then 1-7 Jan 2018 would be week 1 and first week in 2020 would be week 105. This would solve your issue.
The method you are using becomes really hard to handle if your data has multiple years. Weeknum 1 would denote the 1st week of 2020, 2019 and all the other years. This will mess up the calculation. The above method will make sure you have a unique number for a week.

eliminate weekend dates by shifting it on work dates

I have a worksheet in which there is some work that has to be done on any specific date monthly, weekly, quarterly, yearly and daily. I have a formula that auto shows the planned date on which any work has to be done. But there is a need for change in formula that I have only taken all the dates from Monday to Saturday as Sunday is off here.
The problem arises here. please see C13, D13, E13, date of December (12/8/2019) is Sunday. (please see FT13:FW13). so I want that if Sunday falls on any planned date it should roll over to Monday automatically. for example, if 12/8/2019 is sunday this should show up the planned date automatically in cell FV13 (12/9/2019) which is Monday. it means date should be auto roll from Sunday to Monday. however, I have got a formula that can round up the Sunday for monthly planned works. (you can see E12 ,FT12:FW12) but round up of dates is still needed for yearly and quarterly planned works.
https://docs.google.com/spreadsheets/d/1CXjQDjiP_xTnb8DcpsgQKmLyaaV9XX0NdisvcruuOfY/edit#gid=1924994592
you can simply do IF statement to correct the weekend dates acordingly:
=ARRAYFORMULA(IF(A2:A<>"",
IF(TEXT(A2:A, "ddd")="Sat", A2:A+2,
IF(TEXT(A2:A, "ddd")="Sun", A2:A+1, A2:A)), ))

Grand Total not working for sales per day last year function

I am trying to do a sales by day comparison where I compare the sales this year with the sales of the same day last year as a date of the week.
So I would be comparing Monday March 25 2019 with Monday march 24 2018 etc
Here is the formula I’m using for last year’s sale
Amount per Day LY = CALCULATE([Amount TY], FILTER(all(Dates), Dates[Date] = MAX(Dates[Date])-364))
However, my total isn’t working right for my sales last year. It will just be the total for 1 day (and that day seems to change as my date range increases)
Because you are having a one to one, you can do this with LookupValue:
SalesLY = LOOKUPVALUE(Sheet1[Sales];Sheet1[Date];DATEADD(Sheet1[Date];-364;DAY))
However if you have more rows for the same date, this will not hold, in this case you need to sum all the dates together,
SalesLY = CALCULATE(SUM(Sheet1[Sales]);FILTER(Sheet1; DATEADD(Sheet1[Date];364;DAY)= EARLIER(Sheet1[Date])))
Using DateAdd fixed my problem
Amt per Day LY = CALCULATE([Amount TY], DATEADD(Dates[Date], -364,DAY))