<?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: Calculating sales orders, while ignoring certain id's in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2459764#M66520</link>
    <description>&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[Your measure] =
sumx(
    distinct( T[Order] ),
    calculate(        
        switch( true(),
            // if all visible items are User -&amp;gt; SUM the price
            and(
                distinctcount( T[Item] ) = 1,
                "user" in distinct( T[Item] ) ),
                    sum( T[Price] ),
            // if one of the items is Unlimited -&amp;gt; get the value for Unlimited    
            // what happens if there are 2 Unlimited's in the same order?
            "unlimited" in distinct(T[Item] ),
                calculate(
                    selectedvalue( T[Price] ),
                    T[Item] = "unlimited"
                ),
            // if order contains anything else -&amp;gt; SUM the price for User
            calculate(
                sum( T[price] ),
                keepfilters( T[Item] = "user" )
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 17 Apr 2022 18:06:00 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-04-17T18:06:00Z</dc:date>
    <item>
      <title>Calculating sales orders, while ignoring certain id's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2459756#M66518</link>
      <description>&lt;P&gt;Hi PowerBI Community.&lt;BR /&gt;&lt;BR /&gt;I have a little complex sales-orders and needs some help designing the measure.&lt;BR /&gt;I want to create a measure that sums the user price for the order.&lt;BR /&gt;&lt;BR /&gt;If the order contains only "User" - summarize.&lt;BR /&gt;If the order contains "Unlimited" i only want that value, and ignore the rest&lt;BR /&gt;If the order contains anything else (fx. Company) i want to ignore that one and just summarize the Users.&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Order&lt;/TD&gt;&lt;TD&gt;Item&lt;/TD&gt;&lt;TD&gt;Price&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1-ord&lt;/TD&gt;&lt;TD&gt;User&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1-ord&lt;/TD&gt;&lt;TD&gt;User&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2-ord&lt;/TD&gt;&lt;TD&gt;Unlimited&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2-ord&lt;/TD&gt;&lt;TD&gt;User&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2-ord&lt;/TD&gt;&lt;TD&gt;User&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3-ord&lt;/TD&gt;&lt;TD&gt;User&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4-ord&lt;/TD&gt;&lt;TD&gt;User&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5-ord&lt;/TD&gt;&lt;TD&gt;Company&lt;/TD&gt;&lt;TD&gt;10000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5-ord&lt;/TD&gt;&lt;TD&gt;User&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5-ord&lt;/TD&gt;&lt;TD&gt;User&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Expected outcome&lt;BR /&gt;Order 1: 600&lt;BR /&gt;Order 2: 5000&lt;BR /&gt;Order 3: 300&lt;BR /&gt;Order 4: 300&lt;BR /&gt;Order 5: 600&lt;BR /&gt;&lt;BR /&gt;Unsure if this is possible, or if i should maybe add a conditional column so i have only Users and unlimited in a new column, as there are many different variations than "Company" which i want to ignore.&lt;BR /&gt;&lt;BR /&gt;Really hope you can help&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 12:30:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2459756#M66518</guid>
      <dc:creator>FrederikAhring</dc:creator>
      <dc:date>2022-04-16T12:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating sales orders, while ignoring certain id's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2459764#M66520</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[Your measure] =
sumx(
    distinct( T[Order] ),
    calculate(        
        switch( true(),
            // if all visible items are User -&amp;gt; SUM the price
            and(
                distinctcount( T[Item] ) = 1,
                "user" in distinct( T[Item] ) ),
                    sum( T[Price] ),
            // if one of the items is Unlimited -&amp;gt; get the value for Unlimited    
            // what happens if there are 2 Unlimited's in the same order?
            "unlimited" in distinct(T[Item] ),
                calculate(
                    selectedvalue( T[Price] ),
                    T[Item] = "unlimited"
                ),
            // if order contains anything else -&amp;gt; SUM the price for User
            calculate(
                sum( T[price] ),
                keepfilters( T[Item] = "user" )
            )
        )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2022 18:06:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2459764#M66520</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-04-17T18:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating sales orders, while ignoring certain id's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2459770#M66522</link>
      <description>&lt;P&gt;Wow, thats a bit more complicated than i would have figured out.&lt;BR /&gt;Thanks a lot, I will give it a try.&lt;BR /&gt;&lt;BR /&gt;Luckily, there can't be two unlimited in same order.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 13:08:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2459770#M66522</guid>
      <dc:creator>FrederikAhring</dc:creator>
      <dc:date>2022-04-16T13:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating sales orders, while ignoring certain id's</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2460258#M66556</link>
      <description>&lt;P&gt;Very glad to inform you that it works.&lt;BR /&gt;Thank you so much, the help is greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;BR Frederik&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2022 14:32:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-sales-orders-while-ignoring-certain-id-s/m-p/2460258#M66556</guid>
      <dc:creator>FrederikAhring</dc:creator>
      <dc:date>2022-04-17T14:32:38Z</dc:date>
    </item>
  </channel>
</rss>

