<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Switching columns dynamically without unpivoting to display a line chart in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138743#M49139</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Yes, you can, add the date/time column in a line chart and this measure.&lt;BR /&gt;It should show the correct value on a card visual as well.&lt;/P&gt;</description>
    <pubDate>Sun, 17 Oct 2021 10:36:25 GMT</pubDate>
    <dc:creator>Fowmy</dc:creator>
    <dc:date>2021-10-17T10:36:25Z</dc:date>
    <item>
      <title>Switching columns dynamically without unpivoting to display a line chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138698#M49134</link>
      <description>&lt;P&gt;Hey there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to display sales data over time in a line chart.&lt;/P&gt;&lt;P&gt;My table looks similar to this one: The fourth column holds sales in currency code EUR, the fifth column holds it in the local currency if it is different from EUR.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I do not want to unpivot those columns in Power Query as every row would be duplicated in this process and the table becomes messy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Addidtionally I have a slicer, where the user selects whether to show data in local currency or in EUR.&lt;/P&gt;&lt;P&gt;This selection should only impact the data, if a single country is selected (column1).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to achieve a DAX measure, that returns the whole column data - no aggregation - for displaying the data in a line chart.&lt;BR /&gt;Something like this:&amp;nbsp;&lt;BR /&gt;IF(HASONEFILTER([Column1]) AND slicer[selection] = "Local Currency", [Column5], [Column4])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is, that it throws an error because this expression would return a whole column, not a scalar value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to achieve this without unpivoting columns? Do I have to change my data structure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 09:15:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138698#M49134</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-17T09:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Switching columns dynamically without unpivoting to display a line chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138704#M49135</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You cannot return a column in this case, you need to use an aggregator function. Use the following measure, modify the correct table and column names as per your model.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewMeasure =
VAR __Slicer =
    SELECTEDVALUE ( Slicer[selection] )
RETURN
    IF (
        HASONEFILTER ( TableName[Column1] ),
        SWITCH (
            TRUE (),
            __Slicer = "Local Currency", CALCULATE ( SUM ( TableName[Column5] ) ),
            __Slicer = "Foreign Currency", CALCULATE ( SUM ( TableName[Column4] ) )
        )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 09:27:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138704#M49135</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2021-10-17T09:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Switching columns dynamically without unpivoting to display a line chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138737#M49137</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="52518" data-lia-user-login="Fowmy" class="lia-mention lia-mention-user"&gt;Fowmy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, thanks for your answer.&lt;/P&gt;&lt;P&gt;One more question: Would I then be able to display the sales data over time? A Column with datetimes is also in the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I understand correctly, I can only show aggregated values for example on a card visual.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 10:25:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138737#M49137</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-10-17T10:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Switching columns dynamically without unpivoting to display a line chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138743#M49139</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Yes, you can, add the date/time column in a line chart and this measure.&lt;BR /&gt;It should show the correct value on a card visual as well.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 10:36:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switching-columns-dynamically-without-unpivoting-to-display-a/m-p/2138743#M49139</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2021-10-17T10:36:25Z</dc:date>
    </item>
  </channel>
</rss>

