3

Dynamic Reference Line (for Date) in Webi Report

 3 years ago
source link: https://blogs.sap.com/2021/04/07/dynamic-reference-line-for-date-in-webi-report/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Technical Articles
Posted on April 7, 2021 2 minute read

Dynamic Reference Line (for Date) in Webi Report

0 Likes 20 Views 0 Comments

One of the BI folks I know was wondering if there was a way to create reference line for Date in Webi, for one of his requirements, with a way to select/enter a Date to be used. Below is the result (& workaround) I suggested, which worked like charm.

02DateReferenceLine-1.png

Sample data used

01SampleData.png

Step 1: Create a report with the above data set as source from Excel (we’ve 2 columns in the data set, Date and Case Count)

Step 2: Create the below variables

  • Input Reference Date = “” (its a blank Text variable, we’ll create an Input Control type Entry Field on it, so users are able to enter a Date, for which a reference line is needed.)
  • Reference Date =ToDate([Input Reference Date];”MM/dd/yyyy”) (This to convert the Input Reference Date from Text to Date format, so it can be used in the Line Chart)

Next we’ll be creating a bunch of dummy variables, which will help us to create that Reference Date Line in the Chart. Depending on the max value on Y axis and how the Reference Date Line needs to look like, you should create less or more Dot variables.

  • Dot 1 =If([Date]=[Reference Date]) Then 100
  • Dot 2 =If([Date]=[Reference Date]) Then 300
  • Dot 3 =If([Date]=[Reference Date]) Then 500
  • Dot 4 =If([Date]=[Reference Date]) Then 700
  • Dot 5 =If([Date]=[Reference Date]) Then 900
  • Dot 6 =If([Date]=[Reference Date]) Then 1100
  • Dot 7 =If([Date]=[Reference Date]) Then 1300
  • Dot 8 =If([Date]=[Reference Date]) Then 1500
  • Dot 9 =If([Date]=[Reference Date]) Then 1700
  • Dot 10 =If([Date]=[Reference Date]) Then 1900
  • Dot 11 =If([Date]=[Reference Date]) Then 2100

Step 3: Create an Input Control on the Input Reference Date variable, with the Entry Field, as show in the below images.

IC-01.png

IC-02.png

Step 4: Create a Line Chart by assigning data as shown below (result Chart is shown as well).

LC-01.png

LC02.png

Step 5: Update the Chart Title as needed

Step 6: Change the color of Dot 1, Dot 2,… Dot 11 (as many Dot variables we have) to Black (or any other color you want the Reference Line to be), using the Format Data Series option as below. Right click on each of the Dot variable from the Chart legend, and select Format Data Series.

LC-03-1.png

LC-04.png

Step 7: Hide the Chart Legend

Step 8: Test the Reference Date Line by entering a different date in the Input Control (ex: 9/15/20). This is what it looks like, eventually.

LC-05-1.png

Hope this helps some of you in the future! Please feel free to leave feedback, comments, and/or point to any errors in the blog, so I can fix them.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK