Forum Discussion
How add Weekend for the Custom Title?
Hi jac88,
Did you tried my formula?
The blank part that I use is only to avoid having the / on the measure if you don't have events.
Hi MFelix
I have to change the filter direction and made a small change to your formula. So what I am trying to do is based on CalType, weekend days are different. For instance, "iMetaCal" weekends are Friday and Saturday. Rest is a normal weekend (Saturday and Sunday).
Somehow my one is not working the way I want. I
Titles =
VAR NewLine = " / "
VAR Categoryvalue =
CONCATENATEX (
VALUES ( df_ProServUtilizationTracker[Primary Categories] ),
df_ProServUtilizationTracker[Primary Categories],
NewLine
)
VAR Weekendtext =
IF(MAX(df_ProServUtilizationTracker[sp_Employees.CalType]) = "iMetaCal" || MAX ( 'VAR vCalendar'[WeekName] ) IN { "Saturday", "Friday" }, "iMETAWeekend",
IF(MAX(df_ProServUtilizationTracker[sp_Employees.CalType]) = "Standard" || MAX ( 'VAR vCalendar'[WeekName] ) IN { "Saturday", "Sunday" }, "Weekend"))
RETURN
Categoryvalue
& IF ( Weekendtext <> BLANK () && Categoryvalue <> BLANK (), NewLine ) & Weekendtext
If you have a few more minutes, can you please take look at why my changes are wrong? I truly appreciate your help and time. I am so close.
https://drive.google.com/file/d/1tM6gCCZlvoZou2fCs-l8jwG9SDQkRLuF/view
Thank you
- MFelix4 years ago
Super User
- jac884 years ago
Helper II
Hi MFelix ,
Thank you so much for your hlep. I just wanted to know why my changes to your formula are not working. It's showing every day now.
Again, thank you
- MFelix4 years ago
Super User
Hi jac88 ,
The issues are related with context that is giving an incorrect result because of the many to many relationship you have, so in this case the Calendar type is not being pickedup correctly by the employe type but by the manager type.
In this case I have made the following chages to your code:
Titles = VAR calendarType = CALCULATE ( SELECTEDVALUE ( df_ProServUtilizationTracker[sp_Employees.CalType] ), ALLSELECTED ( df_ProServUtilizationTracker[sp_Employees.Name] ) ) VAR NewLine = " / " VAR Categoryvalue = CONCATENATEX ( VALUES ( df_ProServUtilizationTracker[Primary Categories] ), df_ProServUtilizationTracker[Primary Categories], NewLine ) VAR Weekendtext = IF ( calendarType = "iMetaCal" && MAX ( 'VAR vCalendar'[WeekName] ) IN { "Saturday", "Friday" }, "iMETAWeekend", IF ( calendarType = "Standard" && MAX ( 'VAR vCalendar'[WeekName] ) IN { "Saturday", "Sunday" }, "Weekend" ) ) RETURN Categoryvalue & IF ( Weekendtext <> BLANK () && Categoryvalue <> BLANK (), NewLine ) & WeekendtextHas you can see the change on the code is the fact that instead of using the MAX directly to get the CalType i'm making a Calculation of the CalType but restricted by the enmploye name (ALLSELECTED part) this allows to get for that specific person the calendar type.
- MFelix4 years ago
Super User
Hi jac88 ,
You need to use an AND statement on your weekend part and also add a next level of IF to mark all the weekened values try the following:
Titles = VAR NewLine = " / " VAR Categoryvalue = CONCATENATEX ( VALUES ( df_ProServUtilizationTracker[Primary Categories] ), df_ProServUtilizationTracker[Primary Categories], NewLine ) VAR Weekendtext = IF ( MAX ( df_ProServUtilizationTracker[sp_Employees.CalType] ) = "iMetaCal" && MAX ( 'VAR vCalendar'[WeekName] ) IN { "Saturday", "Friday" }, "iMETAWeekend", IF ( MAX ( df_ProServUtilizationTracker[sp_Employees.CalType] ) = "Standard" && MAX ( 'VAR vCalendar'[WeekName] ) IN { "Saturday", "Sunday" }, "Weekend" ) ) RETURN IF ( MAX ( 'VAR vCalendar'[WeekName] ) IN { "Saturday", "Friday" } && Categoryvalue & IF ( Weekendtext <> BLANK () && Categoryvalue <> BLANK (), NewLine ) & Weekendtext = BLANK (), "Weekend", Categoryvalue & IF ( Weekendtext <> BLANK () && Categoryvalue <> BLANK (), NewLine ) & Weekendtext )- jac884 years ago
Helper II
Hello MFelix
Sorry to be a pest, and thank you so much for the quick response. This is almost perfect, but there is a small issue. For instance, "iMetaWeekend" is Friday showing all the way for all employees. I only need to show employees with the Calendar type "iMetaCal".
Do you know by any chance, how to do it by the employee? One last thing, Sunday is not showing as a weekend. Try to find out why is that, but no luck so far.
Again, thank you so much- MFelix4 years ago
Super User
Once again sorry but travelling back home will get an answer tomorrow ASAP.