<?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 BITXOR in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/BITXOR/m-p/1062720#M469</link>
    <description>&lt;P&gt;&lt;A title="" href="https://community.powerbi.com/t5/Community-Blog/Excel-to-DAX-Translation/ba-p/1060991" target="_self"&gt;In my recent quest to create or catalog as many DAX equivalents for Excel functions&lt;/A&gt;&lt;SPAN&gt;,&amp;nbsp;w&lt;/SPAN&gt;&lt;SPAN&gt;ith&amp;nbsp;&lt;/SPAN&gt;&lt;A title="" href="https://community.powerbi.com/t5/Quick-Measures-Gallery/DEC2BIN-Decimal-to-Binary/td-p/1061556" target="_self"&gt;DEC2BIN&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;/SPAN&gt;&lt;A title="" href="https://community.powerbi.com/t5/Quick-Measures-Gallery/BIN2DEC-Binary-to-Decimal/td-p/1061621" target="_self"&gt;BIN2DEC&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;figured out and combining this with the work on &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/XOR/td-p/1062091" target="_self"&gt;XOR&lt;/A&gt; and &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/BITOR-Bitwise-OR/td-p/1062052" target="_self"&gt;BITOR&lt;/A&gt; we can implement a bitwise XOR function, BITXOR:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;BITXOR = 
    VAR __Decimal1 = SELECTEDVALUE('Decimal1'[Decimal1],0)
    VAR __Decimal2 = SELECTEDVALUE('Decimal2'[Decimal2],0)
RETURN
    SWITCH(TRUE(),
        __Decimal1 = 0,__Decimal2,
        __Decimal2 = 0,__Decimal1,
            VAR __Table1 = 
                ADDCOLUMNS(
                    GENERATESERIES(0,LOG(__Decimal1,2),1),
                    "Bit",MOD(TRUNC(__Decimal1 / POWER(2,[Value])),2)
                )
            VAR __Table2 = 
                ADDCOLUMNS(
                    GENERATESERIES(0,LOG(__Decimal2,2),1),
                    "Bit",MOD(TRUNC(__Decimal2 / POWER(2,[Value])),2)
                )
            VAR __Table =
                ADDCOLUMNS(
                    ADDCOLUMNS(
                        GENERATESERIES(0,MAXX({ COUNTROWS(__Table1), COUNTROWS(__Table2) },[Value]) - 1),
                        "Xor",IF(
                                MAXX(FILTER(__Table1,[Value] = EARLIER([Value])),[Bit]) = 
                                    MAXX(FILTER(__Table2,[Value] = EARLIER([Value])),[Bit])
                                ,0,1
                            )
                    ),
                    "Decimal",POWER(2,[Value]) * [Xor]
                )
        RETURN
            SUMX(__Table,[Decimal])
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;NOTE: Just like the original Excel BITXOR function, does not support negative numbers as inputs.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiYWMzOGJhZTctODg1OC00YWM3LWE5MTgtMzgyZTljNGU5ZDZkIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 02 May 2020 16:49:30 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2020-05-02T16:49:30Z</dc:date>
    <item>
      <title>BITXOR</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/BITXOR/m-p/1062720#M469</link>
      <description>&lt;P&gt;&lt;A title="" href="https://community.powerbi.com/t5/Community-Blog/Excel-to-DAX-Translation/ba-p/1060991" target="_self"&gt;In my recent quest to create or catalog as many DAX equivalents for Excel functions&lt;/A&gt;&lt;SPAN&gt;,&amp;nbsp;w&lt;/SPAN&gt;&lt;SPAN&gt;ith&amp;nbsp;&lt;/SPAN&gt;&lt;A title="" href="https://community.powerbi.com/t5/Quick-Measures-Gallery/DEC2BIN-Decimal-to-Binary/td-p/1061556" target="_self"&gt;DEC2BIN&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;and&amp;nbsp;&lt;/SPAN&gt;&lt;A title="" href="https://community.powerbi.com/t5/Quick-Measures-Gallery/BIN2DEC-Binary-to-Decimal/td-p/1061621" target="_self"&gt;BIN2DEC&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;figured out and combining this with the work on &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/XOR/td-p/1062091" target="_self"&gt;XOR&lt;/A&gt; and &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/BITOR-Bitwise-OR/td-p/1062052" target="_self"&gt;BITOR&lt;/A&gt; we can implement a bitwise XOR function, BITXOR:&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;BITXOR = 
    VAR __Decimal1 = SELECTEDVALUE('Decimal1'[Decimal1],0)
    VAR __Decimal2 = SELECTEDVALUE('Decimal2'[Decimal2],0)
RETURN
    SWITCH(TRUE(),
        __Decimal1 = 0,__Decimal2,
        __Decimal2 = 0,__Decimal1,
            VAR __Table1 = 
                ADDCOLUMNS(
                    GENERATESERIES(0,LOG(__Decimal1,2),1),
                    "Bit",MOD(TRUNC(__Decimal1 / POWER(2,[Value])),2)
                )
            VAR __Table2 = 
                ADDCOLUMNS(
                    GENERATESERIES(0,LOG(__Decimal2,2),1),
                    "Bit",MOD(TRUNC(__Decimal2 / POWER(2,[Value])),2)
                )
            VAR __Table =
                ADDCOLUMNS(
                    ADDCOLUMNS(
                        GENERATESERIES(0,MAXX({ COUNTROWS(__Table1), COUNTROWS(__Table2) },[Value]) - 1),
                        "Xor",IF(
                                MAXX(FILTER(__Table1,[Value] = EARLIER([Value])),[Bit]) = 
                                    MAXX(FILTER(__Table2,[Value] = EARLIER([Value])),[Bit])
                                ,0,1
                            )
                    ),
                    "Decimal",POWER(2,[Value]) * [Xor]
                )
        RETURN
            SUMX(__Table,[Decimal])
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;NOTE: Just like the original Excel BITXOR function, does not support negative numbers as inputs.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiYWMzOGJhZTctODg1OC00YWM3LWE5MTgtMzgyZTljNGU5ZDZkIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 16:49:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/BITXOR/m-p/1062720#M469</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-05-02T16:49:30Z</dc:date>
    </item>
  </channel>
</rss>

