<?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 Sum two elements in the same column with a condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3053102#M105230</link>
    <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to do the following:&lt;/P&gt;&lt;P&gt;At my company there are two shifts in a day, and the data is uploaded when each shift ends.&lt;/P&gt;&lt;P&gt;So I have two rows per day.&lt;/P&gt;&lt;P&gt;I need to create two columns (as you can see in red) that sum the hours worked and not worked per day.&lt;/P&gt;&lt;P&gt;The function has to take into account the day, if it is the same, it must add the two values of hours&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody help me?&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2023 15:33:21 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-01-31T15:33:21Z</dc:date>
    <item>
      <title>Sum two elements in the same column with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3053102#M105230</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I want to do the following:&lt;/P&gt;&lt;P&gt;At my company there are two shifts in a day, and the data is uploaded when each shift ends.&lt;/P&gt;&lt;P&gt;So I have two rows per day.&lt;/P&gt;&lt;P&gt;I need to create two columns (as you can see in red) that sum the hours worked and not worked per day.&lt;/P&gt;&lt;P&gt;The function has to take into account the day, if it is the same, it must add the two values of hours&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody help me?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 15:33:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3053102#M105230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-31T15:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sum two elements in the same column with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3054137#M105300</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;It is more advisable to do with table visuals, like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2 reminders: 1) avoid the date hierarchy, 2) choose SUM for the two hour columns.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 02:33:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3054137#M105300</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-01T02:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sum two elements in the same column with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3055233#M105367</link>
      <description>&lt;P&gt;Hello, thank you for the reply.&lt;/P&gt;&lt;P&gt;The problem with that is I need to make other functions after with the values of hours per day. So I need to do it in DAX.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 13:23:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3055233#M105367</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-01T13:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sum two elements in the same column with a condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3055300#M105373</link>
      <description>&lt;P&gt;hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Hs worked/day = 
VAR _worked =
SUMX(
    FILTER(
        TableName,
        TableName[Date]=EARLIER(TableName[Date])
    ),
    TableName[Worked]
)
RETURN
IF([Shift]="B", _worked)

Hs unworked/day = 
VAR _unworked=
SUMX(
    FILTER(
        TableName,
        TableName[Date]=EARLIER(TableName[Date])
    ),
    TableName[Unworked]
)
RETURN
IF([Shift]="B",_unworked)&lt;/LI-CODE&gt;&lt;P&gt;it worked like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 13:47:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-two-elements-in-the-same-column-with-a-condition/m-p/3055300#M105373</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-01T13:47:13Z</dc:date>
    </item>
  </channel>
</rss>

