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 a date column for past 5 years, based on which I created year and weeknum slicer.
When I select the year and week number from the slicer I want to get the wednesday's date.
Please suggest this simple but tricky task.
Thanks.
Solved! Go to Solution.
@aktripathi2506, OK, not sure I 100% understand your scenario, but here is what I came up with:
Started with this Enter Data query:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc7BCQAhEEPRXjwvONF11qlF7L8NF0FMIJd3yh8j9Vz+GTzNZytY1US4iiwojMp4GY3hjI/RGSGnJtIgiYBUQDJwOuYC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}) in #"Changed Type"
Created these three custom columns:
Year = YEAR([Date]) WeekNum = WEEKNUM([Date]) WeekDay = WEEKDAY([Date])
Created this measure:
Wednesday = IF(HASONEVALUE(Wednesday[WeekNum]),CALCULATE(MAX(Wednesday[Date]),FILTER(Wednesday,Wednesday[WeekDay]=4)),DATE(1900,1,1))
Put the Year and WeekNum slicers on a report page and the "Wednesday" measure as a card visualization and it seemed to work OK.
You could use the WEEKDAY function to get the WEEKDAY for each date in a custom column and then filter your visual to just the Wednesday's
https://msdn.microsoft.com/en-us/library/ee634550.aspx
HI @Greg_Deckler, I actually wanted to get wednesday's date so I can use it in another formula.
I can put only one slicer for week (can not put day slicer), so what I was expecting is when I select week (say week 35) then it should get the wednesday's date for that week and subtract this date from deadline date to fet the remaining week number.
@aktripathi2506, OK, not sure I 100% understand your scenario, but here is what I came up with:
Started with this Enter Data query:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc7BCQAhEEPRXjwvONF11qlF7L8NF0FMIJd3yh8j9Vz+GTzNZytY1US4iiwojMp4GY3hjI/RGSGnJtIgiYBUQDJwOuYC", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Date = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}}) in #"Changed Type"
Created these three custom columns:
Year = YEAR([Date]) WeekNum = WEEKNUM([Date]) WeekDay = WEEKDAY([Date])
Created this measure:
Wednesday = IF(HASONEVALUE(Wednesday[WeekNum]),CALCULATE(MAX(Wednesday[Date]),FILTER(Wednesday,Wednesday[WeekDay]=4)),DATE(1900,1,1))
Put the Year and WeekNum slicers on a report page and the "Wednesday" measure as a card visualization and it seemed to work OK.
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 | |
97 | |
75 | |
63 | |
53 |
User | Count |
---|---|
139 | |
100 | |
95 | |
85 | |
63 |