Forum Discussion
Dynamic Reference to Sums
Thanks for the reply TMO_KY !
I used to go with the "Goal Ref Line = #" solution in Tableau before I learned about dynamic ref lines on that platform. Those are better given users change the date ranges of these reports, so weekends and holidays are often included in the runs and so need to be accounted for. I tried the TOTAL GOALS measures you suggested but still came out with results that varied employee to employee.
Took your advice and generated an Excel file without the people's names included--going with generic Employee numbers. (Saved to Google Drive.)
Date range in the data set 2/16-2/29/20 should generate an hours goal of 72 hours for each employee--8 hours per day minus weekends minus holidays--in this case Presidents Day on February 17th.
Ideally that number is then pulled in as the value for the Reference Line in the line and stacked column chart (where the columns depict actual hours logged). The Reference Line would be able to dynamically change based on which date range the user has selected in the slicer.
The export includes three columns of data generated after I connected PBI to my SQL data source. In case the problems I'm having are related to how I've calculated those, here are the formulas I used:
- Day of Week Name = FORMAT('Table'[Date],"dddd")
- isWeekDay = IF((('Table'[Day of Week Name]="Saturday") || ('Table'[Day of Week Name]="Sunday")),"No","Yes")
- HoursGoalforBizDayNOTHoliday = IF(('Table'[isHoliday]=True)||(('Table'[Day of Week Name]="Saturday") || ('Table'[Day of Week Name]="Sunday")),"0","8")
I'm hoping this file (and the above formulas) helps to recreate and troubleshoot.
Thanks again for your reply on Friday!
You may be able to simplify this but here is a link to the PBIX file, DanMandle.PBIX - Google Drive
here are some screenshots:
I've also added in a holiday table that can updated based off the year you input in the parameter/function field inside the query. Let me know if this works for you.