<?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: Need Help Consolidating my 3 Measures into 1! in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2887292#M93625</link>
    <description>&lt;P&gt;DAX is often easier to understand if you break it into multiple logical components like you have. But if you need to put it all in a single measure, then you should be able to substitute in the Total and CustomSales into Division Equation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Division Equation =
SUMX (
    VALUES ( 'Customers'[Markets] ),
    DIVIDE (
        CALCULATE (
            SWITCH (
                SELECTEDVALUE ( 'Customers'[Total US Markets] ),
                "Retailer 4", CALCULATE ( [x], 'ITEM Control'[Control Item] = "N" ),
                CALCULATE ( [$] )
            )
        ),
        CALCULATE ( [x], 'Customers'[Markets] = "All of US" )
    ) * 100
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've done a bit of cleanup in the above. Straight substitution would look like this:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Division Equation =
SUMX (
    VALUES ( 'Customers'[Markets] ),
    DIVIDE (
        (
            CALCULATE (
                SWITCH (
                    SELECTEDVALUE ( 'Customers'[Total US Markets] ),
                    "Retailer 4", CALCULATE ( [x], 'ITEM Control'[Control Item] = "N" ),
                    CALCULATE ( [$] )
                )
            )
        ),
        CALCULATE (
            ( CALCULATE ( 'Sales'[x], 'Customers'[Markets] = "All of US" ) ),
            ALL ( 'Customers'[Markets] )
        ) * 100
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 05 Nov 2022 22:11:07 GMT</pubDate>
    <dc:creator>AlexisOlson</dc:creator>
    <dc:date>2022-11-05T22:11:07Z</dc:date>
    <item>
      <title>Need Help Consolidating my 3 Measures into 1!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2886055#M93543</link>
      <description>&lt;P&gt;Hi I was able to create these 3 measures:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Total = (CALCULATE('Sales'[x], 'Customers'[Markets]="All of US"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CustomSales = (CALCULATE(SWITCH(&lt;/P&gt;&lt;P&gt;SELECTEDVALUE('Customers'[Total US Markets]),&lt;/P&gt;&lt;P&gt;"Retailer 4",&lt;/P&gt;&lt;P&gt;CALCULATE([x],'ITEM Control'[Control Item] = "N"),&lt;/P&gt;&lt;P&gt;CALCULATE([$]))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Division Equation =&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Customers'[Markets]),&lt;BR /&gt;DIVIDE (&lt;BR /&gt;CustomSales,&lt;BR /&gt;CALCULATE ( Total, All('Customers'[Markets] )&lt;BR /&gt;) * 100&lt;BR /&gt;))&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;But I want to improve my DAX and just create one measure to have everything involved.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What the 'Total' Measure is doing is creating my dominator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a bunch of Customers and one of them has this special use case where I need to use a switch statement to get the information for that retailer, this is essentially my numerator (there's 30 different retailers, the switch is only needed for retailer 4)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CustomSales = (CALCULATE(SWITCH(&lt;/P&gt;&lt;P&gt;SELECTEDVALUE('Customers'[Total US Markets]),&lt;/P&gt;&lt;P&gt;"Retailer 4",&lt;/P&gt;&lt;P&gt;CALCULATE([x],'ITEM Control'[Control Item] = "N"),&lt;/P&gt;&lt;P&gt;CALCULATE([$]))))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have this measure doing this Retailer/Total * 100, for each specific retailer&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Division Equation =&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Customers'[Markets]),&lt;BR /&gt;DIVIDE (&lt;BR /&gt;CustomSales,&lt;BR /&gt;CALCULATE ( Total, All('Customers'[Markets] )&lt;BR /&gt;) * 100&lt;BR /&gt;))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoping to get all 3 into just one DAX measure I can copy and paste and send to friends.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 15:45:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2886055#M93543</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-04T15:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help Consolidating my 3 Measures into 1!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2887292#M93625</link>
      <description>&lt;P&gt;DAX is often easier to understand if you break it into multiple logical components like you have. But if you need to put it all in a single measure, then you should be able to substitute in the Total and CustomSales into Division Equation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Division Equation =
SUMX (
    VALUES ( 'Customers'[Markets] ),
    DIVIDE (
        CALCULATE (
            SWITCH (
                SELECTEDVALUE ( 'Customers'[Total US Markets] ),
                "Retailer 4", CALCULATE ( [x], 'ITEM Control'[Control Item] = "N" ),
                CALCULATE ( [$] )
            )
        ),
        CALCULATE ( [x], 'Customers'[Markets] = "All of US" )
    ) * 100
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've done a bit of cleanup in the above. Straight substitution would look like this:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Division Equation =
SUMX (
    VALUES ( 'Customers'[Markets] ),
    DIVIDE (
        (
            CALCULATE (
                SWITCH (
                    SELECTEDVALUE ( 'Customers'[Total US Markets] ),
                    "Retailer 4", CALCULATE ( [x], 'ITEM Control'[Control Item] = "N" ),
                    CALCULATE ( [$] )
                )
            )
        ),
        CALCULATE (
            ( CALCULATE ( 'Sales'[x], 'Customers'[Markets] = "All of US" ) ),
            ALL ( 'Customers'[Markets] )
        ) * 100
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 22:11:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2887292#M93625</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-11-05T22:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help Consolidating my 3 Measures into 1!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2887358#M93631</link>
      <description>&lt;P&gt;Hi I meant to put x for $, at the very end, of the switch statement&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Master Dax Formula =&lt;/P&gt;&lt;P&gt;Total = (CALCULATE('Sales'[x], 'Customers'[Markets]="All of US"))&lt;/P&gt;&lt;P&gt;CustomSales = (CALCULATE(SWITCH(&lt;/P&gt;&lt;P&gt;SELECTEDVALUE('Customers'[Total US Markets]),&lt;/P&gt;&lt;P&gt;"Retailer 4",&lt;/P&gt;&lt;P&gt;CALCULATE([x],'ITEM Control'[Control Item] = "N"),&lt;/P&gt;&lt;P&gt;CALCULATE([x]))))&lt;/P&gt;&lt;P&gt;Division Equation =&lt;BR /&gt;SUMX (&lt;BR /&gt;VALUES ( 'Customers'[Markets]),&lt;BR /&gt;DIVIDE (&lt;BR /&gt;CustomSales,&lt;BR /&gt;CALCULATE ( Total, All('Customers'[Markets] )&lt;BR /&gt;) * 100&lt;BR /&gt;))&lt;/P&gt;&lt;P&gt;is actually my code im sorry.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 03:58:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2887358#M93631</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-06T03:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help Consolidating my 3 Measures into 1!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2934909#M96655</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;What's your expected result? Could you please provide some &lt;STRONG&gt;raw data&lt;/STRONG&gt; and explain the&lt;STRONG&gt; calculation logic&lt;/STRONG&gt; using some specific examples and backend scenario?&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;It is better&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;if you can share a&amp;nbsp;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;simplified&lt;/STRONG&gt;&amp;nbsp;&lt;/FONT&gt;pbix file. You can refer the following link to upload the file to the community. Thank you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FDesktop%2FHow-to-upload-PBI-in-Community%2Fm-p%2F1672886&amp;amp;data=04%7C01%7Cv-yiruan%40microsoft.com%7C4f580813734d4a8355b008da16f6e91a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637847547341062885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;amp;sdata=YJvujige2YITXKbKED9JieQm5LBdf%2F3IYPM4ggdiijQ%3D&amp;amp;reserved=0" target="_blank" rel="nofollow noopener noreferrer"&gt;How to upload PBI in Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 07:50:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-Help-Consolidating-my-3-Measures-into-1/m-p/2934909#M96655</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-29T07:50:54Z</dc:date>
    </item>
  </channel>
</rss>

