<?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: Currency Switch Measure is Mixing All Currencies at Row Level in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2680865#M80282</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your issue should be caused by [OnlyCanadaSelected] measure.&lt;/P&gt;
&lt;P&gt;Due to the row context, in "CA" level, there should be no other countrys &amp;lt;&amp;gt; "CA", so&amp;nbsp;[OnlyCanadaSelected] will return "Yes", [Sales $] will return CAD$&lt;/P&gt;
&lt;P&gt;in "US" level, there should be no other countrys = "CA", so&amp;nbsp;[OnlyCanadaSelected] will return "No", [Sales $] will return USD$&lt;/P&gt;
&lt;P&gt;in subtotal, there should be all countries from the whole table, so&amp;nbsp;[OnlyCanadaSelected] will return "No", you will get correct total, USD$.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OnlyCanadaSelected = IF(COUNTROWS(FILTER(FlashSalesSites,FlashSalesSites[Country]&amp;lt;&amp;gt; "CA")) = 0,"Yes","No")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OnlyCanadaSelected =
IF (
    COUNTROWS (
        FILTER ( ALL ( FlashSalesSites ), FlashSalesSites[Country] &amp;lt;&amp;gt; "CA" )
    ) = 0,
    "Yes",
    "No"
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try ALL()&amp;nbsp;function to remove filter from your data model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Aug 2022 07:58:52 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-08-04T07:58:52Z</dc:date>
    <item>
      <title>Currency Switch Measure is Mixing All Currencies at Row Level</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2673846#M79829</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We have a report built where a slicer can select between either US or CA. This is triggering a switch measure to select either the USD$ or CAD$ column from the DB Table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sales $ =

        Switch(true(),

        [OnlyCanadaSelected]="No",[Sales (USD)],

        [OnlyCanadaSelected]="Yes",[Sales (Local)])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OnlyCanadaSelected = IF(COUNTROWS(FILTER(FlashSalesSites,FlashSalesSites[Country]&amp;lt;&amp;gt; "CA")) = 0,"Yes","No")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When trouble shooting the model, I see that "Sales $" column shows local currency for both countries due to the row level context BUT the Grand Total for the matrix is totaling in USD$:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried multiple rewrites of the logic but cannot get around the row level. Also, I cannot understand why the Grand Total is correct? I would love some suggestions on how to correct!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2022 20:08:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2673846#M79829</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-01T20:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Switch Measure is Mixing All Currencies at Row Level</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2674345#M79853</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Ideally speaking you should not show grand total for mixed currency or try like &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales $ =Sumx(Values(Table[Country]) , 
       calculate( Switch(true(),
        [OnlyCanadaSelected]="No",[Sales (USD)],
        [OnlyCanadaSelected]="Yes",[Sales (Local)]) ))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 02 Aug 2022 03:35:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2674345#M79853</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-08-02T03:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Switch Measure is Mixing All Currencies at Row Level</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2676539#M80010</link>
      <description>&lt;P&gt;Yes I agree. I am trying to show only USD$ currency in "Sales $" with the switch measures listed. I cannot seem to remove the row level context however for "CA" which is causing the mixed currency issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies for not being more clear in the orginal post.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Aug 2022 20:43:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2676539#M80010</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-02T20:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Switch Measure is Mixing All Currencies at Row Level</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2680865#M80282</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think your issue should be caused by [OnlyCanadaSelected] measure.&lt;/P&gt;
&lt;P&gt;Due to the row context, in "CA" level, there should be no other countrys &amp;lt;&amp;gt; "CA", so&amp;nbsp;[OnlyCanadaSelected] will return "Yes", [Sales $] will return CAD$&lt;/P&gt;
&lt;P&gt;in "US" level, there should be no other countrys = "CA", so&amp;nbsp;[OnlyCanadaSelected] will return "No", [Sales $] will return USD$&lt;/P&gt;
&lt;P&gt;in subtotal, there should be all countries from the whole table, so&amp;nbsp;[OnlyCanadaSelected] will return "No", you will get correct total, USD$.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OnlyCanadaSelected = IF(COUNTROWS(FILTER(FlashSalesSites,FlashSalesSites[Country]&amp;lt;&amp;gt; "CA")) = 0,"Yes","No")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OnlyCanadaSelected =
IF (
    COUNTROWS (
        FILTER ( ALL ( FlashSalesSites ), FlashSalesSites[Country] &amp;lt;&amp;gt; "CA" )
    ) = 0,
    "Yes",
    "No"
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try ALL()&amp;nbsp;function to remove filter from your data model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 07:58:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2680865#M80282</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-04T07:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Switch Measure is Mixing All Currencies at Row Level</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2682265#M80371</link>
      <description>&lt;P&gt;Unfortunately your formula will only give a "NO" result regardless of the filter selection as it is using the COUNTROWS against the entire data set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have solved the issue today using the below logic:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OnlyCanadaSelectedTEST = 
IF (
    Calculate(
            COUNTROWS (
        FILTER ( ALLSELECTED( FlashSalesSites ), FlashSalesSites[Country] &amp;lt;&amp;gt; "CA" ))
    ) = 0,
    "Yes",
    "No"
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had to also use this in conjunction with a "Is Not Blank" filter on my "Sites" as there were phantom locations pulling in with no "Country" information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate everyone helping me think this through!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 15:51:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Currency-Switch-Measure-is-Mixing-All-Currencies-at-Row-Level/m-p/2682265#M80371</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-04T15:51:22Z</dc:date>
    </item>
  </channel>
</rss>

