Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have created a report displaying initiated dates weekly since 2018
This report has worked perfectly up until April 30th and I am not sure why.
The column "init" is the init date in the system, the "testtt" column is how I am able to create the same weekly incraments for all 3 years, and the "Init Start of Week test" column is the weeks I want to display.
As you can see, on April 30th, the "Init Start of Week test" column is blank.... it continues to be blank up until the current date.
Below are the formulas I used to get each column...
@Anonymous
It is really overly long and messy, first of all I would suggest to change your formula to Switch(true() for multiple if function, and use && instead of And().
https://docs.microsoft.com/en-us/dax/switch-function-dax
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
attached is a screenshot
@Anonymous , please see if you can use
Monday to Sunday week
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Sunday to Saturday Week
Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],1)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],1)
@amitchandak this doesnt work bc for example, monday-sunday of week may 4 2020-may 10 2020 is different than last year, as may 4th is a saturday in 2019 instead of a monday in 2020 😞
@Anonymous , Not sure I got you. If you always need Sunday to Saturday week, this should work for all your date in the calendar.
Can explain the output you need
hm, @amitchandak
I do need monday-sunday calendar weeks, but only for 2020. for 2019 and 2018, I want the same dates in the week as 2020, so in the previous example i would want the week of May 4 2020 - May 10 2020, but for 2019, I would want the same week, May 4 2019 - May 10 2019
that is why my DAX formula is so long... to accomidate the fact that may 4 2019 is on a Saturday, not a monday, but is included in the week May 4 - May 10
Hope this makes a little bit more sense... I am not the best at explaining things...
Thank you!
Sarah
Try LIke. Quick Calc. Do modification as per need
Var _Date =
switch( True ,
[year] =2019 , date(year([Date])+1,month([Date]),Day([Date]))
[year] =2018 , date(year([Date])+2,month([Date]),Day([Date]))
)
var _wt = _Date+-1*WEEKDAY(_Date,2)+1
return
switch( True ,
[year] =2019 , date(year(_wt)-1,month(_wt),Day(_wt))
[year] =2018 , date(year(_wt)-2,month(_wt),Day(_wt))
)
not sure i understand... i just dont understand why my formula stops outputting start of week dates after 4/30/2020... it works perfectly with my other dates before that date
Your DAX expression appears to be overly long and complex, and there is likely a more efficient way to reach your goal. Can you post an example of your full starting table and your desired output and the community can likely propose a different approach?
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
https://docs.google.com/spreadsheets/d/15uDsBpI1gwDsppWgsTeQG0XmWLTuS6Sx/edit#gid=1402235018
here is a sample spreadsheet
I just got rid of duplicate "INIT DATE"s... My desired output would be the "init start of week official" column, but from there i want the "Init Week" column so i can use it as a filter for all 3 years, if this makes sense
Thank you!
Sarah
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
99 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |