brendalpzm
Board Regular
- Joined
- Oct 3, 2022
- Messages
- 59
- Office Version
- 365
- 2021
- 2019
- 2016
- Platform
- Windows
I am making a booking system for what I am developing a weekly view calendar, I am creating a gallery for the headers of this calendar.
The thing is that in the calendar some months contain a few days from other months, like the follwing picture
as you see the month is January (Enero) and there are 3 days of February showing. As shown in the picture, the logic I want to apply is whenever the days doesn't belong to the selected month on top, to specify the month of those days only between parethesis ( ), I have been trying a lot of things to get it right, 2 days of trying and still can figure it out. Could you help me out with this?
I attach the code I am using as well
The thing is that in the calendar some months contain a few days from other months, like the follwing picture
as you see the month is January (Enero) and there are 3 days of February showing. As shown in the picture, the logic I want to apply is whenever the days doesn't belong to the selected month on top, to specify the month of those days only between parethesis ( ), I have been trying a lot of things to get it right, 2 days of trying and still can figure it out. Could you help me out with this?
I attach the code I am using as well
Power Query:
If(Month((DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days)))=Month((DateAdd(_FirstDayofWeek-1,ThisItem.Value-2,TimeUnit.Days))),
///If it's the same month as the month selected
(If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Saturday",
"Sábado "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Sunday",
"Domingo "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Monday",
"Lunes "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Tuesday",
"Martes "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Wednesday",
"Miércoles "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Thursday",
"Jueves "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Friday",
"Viernes "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")))))))))),
///If it is not the same month
(If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Saturday",
"Sábado "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Sunday",
"Domingo "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Monday",
"Lunes "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Tuesday",
"Martes "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Wednesday",
"Miércoles "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Thursday",
"Jueves "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd")),
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dddd"))="Friday",
"Viernes "&(Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"dd"))))))))))&" ("&(If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Jan","Ene)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Feb","Feb)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Mar","Mar)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Apr","Abr)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="May","May)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Jun","Jun)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Jul","Jul)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Aug","Ago)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Sep","Sep)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Oct","Oct)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Nov","Nov)",
If((Text(DateAdd(_FirstDayofWeek-1,ThisItem.Value,TimeUnit.Days),"mmm"))="Dec","Dic)",""))))))))))))))