Projekt

Allgemein

Profil

Dashboard Beispiele » Historie » Version 1

[Y] Andreas F, 10.12.2020 11:02

1 1 [Y] Andreas F
h1. Dashboard Beispiele
2
3
h2. Bestellvolumen im Jahr je Woche gegen Budget
4
!clipboard-202012101056-wlafr.png!
5
6
{{collapse(SQLs)
7
<pre><code class="sql">
8
-- Je Woche (oben)
9
SELECT 
10
  To_char(ld_datum, 'YY"KW"IW') AS year_week,
11
  SUM(ld_netto_basis_w) AS ld_netto_basis_w,
12
  5000 as planned
13
FROM ldsdok 
14
WHERE ld_code = 'E' -- nur externe Bestellungen
15
AND ld_datum > today() - 365
16
GROUP BY year_week
17
ORDER BY year_week
18
-- Kumuliert (unten)
19
WITH _baseqry AS (
20
	SELECT 
21
	  To_char(ld_datum, 'YY"KW"IW') AS year_week,
22
	  SUM(ld_netto_basis_w) AS ld_netto_basis_w,
23
	  5000 AS planned
24
	FROM ldsdok 
25
	WHERE ld_code = 'E' -- nur externe Bestellungen
26
	AND ld_datum > today() - 365
27
	GROUP BY year_week
28
	ORDER BY year_week
29
)
30
31
SELECT 
32
  t1.year_week,
33
  SUM(t2.ld_netto_basis_w) AS ld_netto_basis_w,
34
  SUM(t2.planned) AS planned
35
FROM _baseqry t1
36
INNER JOIN _baseqry t2 ON t1.year_week >= t2.year_week
37
GROUP BY t1.year_week
38
ORDER BY t1.year_week
39
</code></pre>
40
}}
41
42
h2. Hauptlieferanten mit Risikobewertung
43
44
Beispiel für Anwendung von Kundeneigenschaften an den Lieferantendaten
45
!clipboard-202012101101-udmqt.png!
46
47
48
{{collapse(SQL)
49
<pre><code class="sql">
50
SELECT
51
ad_krz,
52
ad_fa1,
53
ad_land,
54
a2_haupt,
55
trecnoparam.getinteger('Risk.SinglesSource', adk.dbrid) AS SinglesSource,
56
trecnoparam.getinteger('Risk.QPerformance', adk.dbrid) AS QPerformance,
57
trecnoparam.getinteger('Risk.TPerformance', adk.dbrid) AS TPerformance,
58
trecnoparam.getinteger('Risk.Country', adk.dbrid) AS Country,
59
trecnoparam.getinteger('Risk.Capacity', adk.dbrid) AS Capacity,
60
trecnoparam.getinteger('Risk.Financial', adk.dbrid) AS Financial,
61
trecnoparam.getinteger('Risk.Certification', adk.dbrid) AS Certification,
62
trecnoparam.getinteger('Risk.NoRisk', adk.dbrid) AS NoRisk
63
FROM
64
 adk 
65
 LEFT JOIN adk2 ON ad_krz=a2_krz
66
WHERE a2_haupt LIKE 'H%'
67
</code></pre>
68
}}