{"id":453,"date":"2014-08-18T13:04:57","date_gmt":"2014-08-18T11:04:57","guid":{"rendered":"http:\/\/www.flip-design.de\/?p=453"},"modified":"2014-08-18T13:04:57","modified_gmt":"2014-08-18T11:04:57","slug":"powerpivot-switch-funktion-oder-auch-wie-komme-ich-ohne-hilfstabellen-bei-uebersetzungen-aus","status":"publish","type":"post","link":"https:\/\/www.flip-design.de\/?p=453","title":{"rendered":"PowerPivot: Switch() Funktion \u2013 oder auch: Wie komme ich ohne Hilfstabellen bei \u00dcbersetzungen aus?"},"content":{"rendered":"<p><a href=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2013\/04\/PowerPivot_Logo.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft  wp-image-270\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2013\/04\/PowerPivot_Logo.png\" alt=\"PowerPivot_Logo\" width=\"98\" height=\"99\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2013\/04\/PowerPivot_Logo.png 252w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2013\/04\/PowerPivot_Logo-150x150.png 150w\" sizes=\"(max-width: 98px) 100vw, 98px\" \/><\/a><a href=\"#en\">English version below<\/a><\/p>\n<p>Wenn man einfache \u00dcbersetzungen in Daten vornehmen wollte, bspw. Gruppenschl\u00fcssel in Namen zu \u00fcbersetzen, bediente ich mich bisher immer an Hilfstabellen die ich in Excel definiert und dann in das Datenmodell eingebunden haben.<\/p>\n<p>So in etwa \u2013 eine Tabelle beinhaltet einen Schl\u00fcssel um eine Kundengruppe zu beschreiben. Die Beschreibung befindet sich in einer Hilfstabelle die in PowerPivot eingebunden wird und per Verkn\u00fcpfung dann die \u00dcbersetzung vornimmt. Problem dabei ist meist, wenn ein Wert in den Daten vorkommt, der nicht in der \u00dcbersetzung Tabelle vorkommt. Da habe ich dann per einer berechneten Spalte per Bedingter Anweisung die fehlenden Werte markiert.<\/p>\n<p>Hier der vorherige Weg:<\/p>\n<p><a href=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-37-08.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft  wp-image-455\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-37-08.png\" alt=\"2014-08-18_12-37-08\" width=\"198\" height=\"246\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-37-08.png 249w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-37-08-241x300.png 241w\" sizes=\"(max-width: 198px) 100vw, 198px\" \/><\/a> <a href=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-39-03.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft  wp-image-456\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-39-03.png\" alt=\"2014-08-18_12-39-03\" width=\"467\" height=\"183\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-39-03.png 584w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-39-03-300x117.png 300w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;&nbsp;<\/p>\n<p>&nbsp;&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Hier kommt nun die SWITCH Funktion ins Spiel.<\/p>\n<p>Mit dieser kann ich Werte \u00fcberpr\u00fcfen und \u00fcbersetzen. Grunds\u00e4tzlich geht das Ganze auch mit einer IF Funktion, aber deutlich un\u00fcbersichtlicher und somit schlecht in der Wartung.<\/p>\n<pre>=SWITCH(Customers[Group]; \"A\"; \"High Priority\"; \"B\"; \"B Customers\"; \r\n\"C\"; \"C Customers\"; \"no valid group\")<\/pre>\n<p>Der Grundsyntax von SWITCH:<\/p>\n<pre>SWITCH(<em>expression<\/em>, \r\n \u00a0\u00a0 <em>value1, result1<\/em>,\r\n \u00a0\u00a0 <em>value2, result2<\/em>,\r\n \u00a0\u00a0\u00a0 :\r\n \u00a0\u00a0\u00a0 :\r\n \u00a0\u00a0\u00a0 <em>else<\/em>\r\n \u00a0\u00a0 )<\/pre>\n<p><a href=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-41-07.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-457\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-41-07.png\" alt=\"2014-08-18_12-41-07\" width=\"864\" height=\"321\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-41-07.png 864w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-41-07-300x111.png 300w\" sizes=\"(max-width: 864px) 100vw, 864px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h1><a name=\"en\"><\/a>PowerPivot Switch Function \u2013 or the end of the linked translation tables?<\/h1>\n<p>If you wanted to make simple translations in data, for example I want to translate a Customer Group Key in a name, I used to create translations Tables in Excel and then integrated into the data model of PowerPivot.<br \/>\nSomething like that &#8211; a table contains a key to a customer group to describe. The description is another table that is linked in PowerPivot and then performs the translation by a relationship. Problem is mostly, if a value exists in the data that is not present in the translation table. Since then I have checked the missing values \u200b\u200bby a calculated column using a IF\/ELSE statement.<br \/>\nHere the previous path:<br \/>\n<a href=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-37-08.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft  wp-image-455\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-37-08.png\" alt=\"2014-08-18_12-37-08\" width=\"198\" height=\"246\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-37-08.png 249w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-37-08-241x300.png 241w\" sizes=\"(max-width: 198px) 100vw, 198px\" \/><\/a> <a href=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-39-03.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft  wp-image-456\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-39-03.png\" alt=\"2014-08-18_12-39-03\" width=\"467\" height=\"183\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-39-03.png 584w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-39-03-300x117.png 300w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;&nbsp;<\/p>\n<p>&nbsp;&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Here are the SWITCH function:<br \/>\nWith this I can check values \u200b\u200band translate. Basically, the whole thing goes well with an IF function, but much less clear and thus poorly in maintenance.<\/p>\n<pre> =SWITCH (Customers[Group], \"A\", \"High Priority\", \"B\", \"B Customers\", \r\n\"C\", \"C Customers\", \"no valid group\")<\/pre>\n<p>The basic syntax of SWITCH:<\/p>\n<pre>SWITCH(<em>expression<\/em>, \r\n \u00a0\u00a0 <em>value1, result1<\/em>,\r\n \u00a0\u00a0 <em>value2, result2<\/em>,\r\n \u00a0\u00a0\u00a0 :\r\n \u00a0\u00a0\u00a0 :\r\n \u00a0\u00a0\u00a0 <em>else<\/em>\r\n \u00a0\u00a0 )<\/pre>\n<p><a href=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-41-07.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-457\" src=\"http:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-41-07.png\" alt=\"2014-08-18_12-41-07\" width=\"864\" height=\"321\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-41-07.png 864w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2014\/08\/2014-08-18_12-41-07-300x111.png 300w\" sizes=\"(max-width: 864px) 100vw, 864px\" \/><\/a><br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>English version below Wenn man einfache \u00dcbersetzungen in Daten vornehmen wollte, bspw. Gruppenschl\u00fcssel in Namen zu \u00fcbersetzen, bediente ich mich bisher immer an Hilfstabellen die ich in Excel definiert und dann in das Datenmodell eingebunden haben. So in etwa \u2013 &hellip; <a href=\"https:\/\/www.flip-design.de\/?p=453\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":270,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[30,41,26,36],"tags":[46,44],"_links":{"self":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/453"}],"collection":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=453"}],"version-history":[{"count":5,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/453\/revisions"}],"predecessor-version":[{"id":461,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/453\/revisions\/461"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/media\/270"}],"wp:attachment":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}