---
tags:
  - IT/Tools/Obsidian
  - IT/Tools/Obsidian/Dataview
---


```javascript
let groups = dv.pages('#process/goal').where(j => j.file.name !="Ziel Template").groupBy(z => z.type)
const sortBy = ["Beruflich", "Wissen", "Wohlstand", "Leben"];
const sortByObject = sortBy.reduce((obj, item, index) => { obj[item] = index
  return obj
}, {})
groups.values.sort((a, b) => sortByObject[a["key"]] - sortByObject[b["key"]]);
for (let group of groups) {
	dv.header(3, group.key);
    let ziele = new Set();
    for (let ziel of group.rows) {
        let total = ziel.file.inlinks.where(j => dv.page(j).category == "Steuererklärung").length
        let open = ziel.file.inlinks.where(j => dv.page(j).category == "Steuererklärung")
            .where(j => dv.page(j).status != "Geschlossen")
            .where(j => dv.page(j).status != "Abgewiesen")
            .length
        let progress = Math.round((total-open)/total*100,0)
        let current = total-open
        let max = ziel.Target || 0;
        let value = ziel.Progress || 0;
        let progressBar = Math.round((value / max) * 100) || 0;
        if (total > 0) {
            ziele.add([ziel.file.link, total, open, "<progress max=" + total + " value=" + current + "> </progress> " + progress + "%", max, value, ziel.Bar])
        } else {
            ziele.add([ziel.file.link, total, open, "Keine Tickets", max, value, ziel.Bar])
        }
    }
    dv.table(["Ziel", "Total", "Offen", "Progress", "Target", "Progress", "Bar"], Array.from(ziele))
}
```
