<?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: CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4415151#M175327</link>
    <description>&lt;P&gt;That did it! Thank you so much, can't tell you how helpful this was. This makes me want to go back and rethink other projects as well. I may be back here before long haha. 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;</description>
    <pubDate>Tue, 18 Feb 2025 06:54:17 GMT</pubDate>
    <dc:creator>cescovedo</dc:creator>
    <dc:date>2025-02-18T06:54:17Z</dc:date>
    <item>
      <title>CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4412665#M175243</link>
      <description>&lt;P&gt;Hi, I'm trying to CALCULATE the SUM of meeting hours for each userID, by creating a new table from a reference table. However, I have a column for primary userID, and a separate column for secondary userIDs, which is a string of comma separated userIDs. I can do it easily for the primary userID column, but I'm unable for the secondary userIDs, probably because I need to search the value for text by iterating through each userID. I tried transforming the secondary userID column to expand into additional rows and separate the comma-separated string, but then that I would have to calculate the sum of distinct values for the primary userID column, and can't find a way to do that either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Meeting Hours' table&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;MeetingID&lt;/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;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1.25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;TD&gt;1.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1.75&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13&lt;/TD&gt;&lt;TD&gt;0.25&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 16 Feb 2025 22:06:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4412665#M175243</guid>
      <dc:creator>cescovedo</dc:creator>
      <dc:date>2025-02-16T22:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4412716#M175245</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="728770" data-lia-user-login="cescovedo" class="lia-mention lia-mention-user"&gt;cescovedo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how I would suggest setting up the model (PBIX attached).&lt;/P&gt;
&lt;P&gt;I have added some made-up attributes for illustrative purposes.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;User (dimension)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Meeting (dimension)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;MeetingHours (fact)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;MeetingUser (fact/bridge)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;MeetingUser is constructed by splitting SecondaryUserID by comma into rows, then appending Primary &amp;amp; Secondary users (see Power Query).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can then create measures like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Meeting Hours = 
SUM ( MeetingHours[MeetingHours] )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Primary Meeting Hours = 
CALCULATE (
    [Meeting Hours],
    KEEPFILTERS ( MeetingUser[UserType] = "Primary" )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Secondary Meeting Hours = 
CALCULATE (
    [Meeting Hours],
    KEEPFILTERS ( MeetingUser[UserType] = "Secondary" )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To construct a visual similar to your Summary table, you can either:&lt;/P&gt;
&lt;P&gt;1. Create a Matrix with &lt;STRONG&gt;User[UserID]&lt;/STRONG&gt; on rows, &lt;STRONG&gt;MeetingUser[UserType]&lt;/STRONG&gt; on columns, and &lt;STRONG&gt;Meeting Hours&lt;/STRONG&gt; on Values.&lt;/P&gt;
&lt;P&gt;2. Create a Table/Matrix with &lt;STRONG&gt;User[UserID]&lt;/STRONG&gt; on rows, and two measures &lt;STRONG&gt;Primary Meeting Hours&lt;/STRONG&gt; and &lt;STRONG&gt;Secondary Meeting Hours&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Would something like this work for you?&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2025 23:28:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4412716#M175245</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-02-16T23:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4414431#M175308</link>
      <description>&lt;P&gt;Amazing, thank you! This makes a lot more sense to do it this way. I was able to build the model and tables the way you outlined, but I think I'm going wrong somewhere with the calculation measures, because the hours are adding up to "10" for every UserId. I did get an error that one of my MeetingHours columns was text instead of numeric, so I fixed that, but that didn't fix the issue with the visualization tables/matrices.&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 don't see a way to attach my pbix file, how did you do that?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2025 20:03:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4414431#M175308</guid>
      <dc:creator>cescovedo</dc:creator>
      <dc:date>2025-02-17T20:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4414444#M175309</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="728770" data-lia-user-login="cescovedo" class="lia-mention lia-mention-user"&gt;cescovedo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the update!&lt;/P&gt;
&lt;P&gt;Actually attaching files is a Super User-only feature on these forums.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can share via Google Drive, OneDrive etc and post the link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the meantime, one thing to check is the relationship between MeetingUser and Meeting has &lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-create-and-manage-relationships" target="_blank" rel="noopener"&gt;Cross filter direction set to "Both"&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2025 20:23:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4414444#M175309</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-02-17T20:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4415151#M175327</link>
      <description>&lt;P&gt;That did it! Thank you so much, can't tell you how helpful this was. This makes me want to go back and rethink other projects as well. I may be back here before long haha. 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;</description>
      <pubDate>Tue, 18 Feb 2025 06:54:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4415151#M175327</guid>
      <dc:creator>cescovedo</dc:creator>
      <dc:date>2025-02-18T06:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4422771#M175575</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Was hoping you could help me with a related question. In my USER table, I have a new column for how many hours the given user can work. I wanted to create a measure for these, and then create another measure that subtracts the sum of primary+secondary hours from the available hours. It looks like the measure is iterating through every user and not matching on the EISPhysicianID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is partly because I don't totally understand what you're doing with the Meeting Hours/Primary/Secondary measures. It seems like you're using the SUM aggregation measure, and that is iterating through the MeetingUser table for each ID and EISPhysicianID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So perhaps I need a table similar to MeetingUser that joins the Meeting ID, EISPhysicianID, and AvailableHours?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume I would also have to update the model, but its not letting me make the connection, presumably because I don't have the right columns between those 2 tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I suppose the main question is: Can you put Measures from different tables into the same matrix, or no?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1iu9UuGfrC5Z97kcjijTjtLyGV3Xi3smD/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1iu9UuGfrC5Z97kcjijTjtLyGV3Xi3smD/view?usp=sharing&lt;/A&gt;&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Feb 2025 00:23:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4422771#M175575</guid>
      <dc:creator>cescovedo</dc:creator>
      <dc:date>2025-02-22T00:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4423837#M175622</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="728770" data-lia-user-login="cescovedo" class="lia-mention lia-mention-user"&gt;cescovedo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sure thing, I had another look at this and attached an updated PBIX &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I adjusted a things. The key changes are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You should generally use &lt;STRONG&gt;User[EISPhusicianId]&lt;/STRONG&gt; in visuals, not &lt;STRONG&gt;MeetingUser[EISPhusicianId]&lt;/STRONG&gt;. I changed this in the table visual.&lt;BR /&gt;The reason is that User is intended to be the User dimension that filters all other related tables. MeetingUser is a bridge table that ensures Users are related to both their Primary &amp;amp; Secondary meetings, but doesn't need to be visible when creating reports. I have hidden &lt;STRONG&gt;MeetingUser&lt;/STRONG&gt; for now.&lt;/LI&gt;
&lt;LI&gt;Adjusted the &lt;STRONG&gt;Unscheduled Hours&lt;/STRONG&gt; measure as follows:&lt;BR /&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;SPAN&gt;Unscheduled Hours = &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SUMX&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; User,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; [Available Hours] - [MeetingHours]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
SUMX iterates over &lt;STRONG&gt;User&lt;/STRONG&gt; and adds &lt;STRONG&gt;Available Hours - MeetingHours&lt;/STRONG&gt; for each.&lt;BR /&gt;&lt;STRONG&gt;MeetingHours&lt;/STRONG&gt; should always be equal to &lt;STRONG&gt;Primary Meeting Hours&lt;/STRONG&gt; + &lt;STRONG&gt;Secondary Meeting Hours&lt;/STRONG&gt; (as long as the same user isn't Primary &amp;amp; Secondary in the same meeting).&lt;/LI&gt;
&lt;LI&gt;In the visual below, note that &lt;STRONG&gt;Primary &lt;/STRONG&gt;&amp;amp; &lt;STRONG&gt;Secondary Hours&lt;/STRONG&gt;&amp;nbsp;totals only count each meeting once. You could sum these per User by wrapping in SUMX ( User, ... ) if you wanted.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Hope that's some help!&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2025 03:10:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4423837#M175622</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-02-24T03:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: CALCULATE SUM for all UserIDs when UserID text is contained in the string value of another column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4586777#M175715</link>
      <description>&lt;P&gt;Thank you! Yes that seems to have done it. I came across SUMX but thought it wasn't right for some reason. The primary and secondary hours are counting things up appropriately so somehow that seems to be working without SUMX. But I could change it for consistency and future proofing.&amp;nbsp; Really appreciate your help with this.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2025 21:54:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/CALCULATE-SUM-for-all-UserIDs-when-UserID-text-is-contained-in/m-p/4586777#M175715</guid>
      <dc:creator>cescovedo</dc:creator>
      <dc:date>2025-02-26T21:54:26Z</dc:date>
    </item>
  </channel>
</rss>

