<?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 How to subtotal in matrix with lookup values in measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtotal-in-matrix-with-lookup-values-in-measure/m-p/3087142#M107974</link>
    <description>&lt;P&gt;I need some help in summing/subtotalling a column of values that are made up of a measure which does a lookupvalue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a matrix report. In it are grouped projects and tasks within each project. I created a measure that does a lookupvalue to get the budgeted hours for each of those tasks based on the project name/task name. That seems to work fine. However subtotalling at the project level does not and also there is no grand total. The lookupvalue doesn't make sense to do at a project level without a task name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column Budgeted Hours is this measure:&lt;/P&gt;&lt;P&gt;budgethourlookupt = if(ISINSCOPE(cr7e9_timesheet[Program Task]), LOOKUPVALUE(cr7e9_programtasks[Budget Hours],cr7e9_programtasks[cr7e9_program],selectedvalue(cr7e9_timesheet[cr7e9_program]),cr7e9_programtasks[Name],SELECTEDVALUE(cr7e9_timesheet[Name 2]),0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what to put in when it's not in scope (at the project level) that would represent what the subtotal of the project's tasks budgeted hours are.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imagine if the subtotals can be figured out then the grand total will naturally appear (or I'll have to use the HASONEVALUE to determine when to do a grand total).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope someone can hep me figure this out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;</description>
    <pubDate>Mon, 20 Feb 2023 05:52:33 GMT</pubDate>
    <dc:creator>simontam</dc:creator>
    <dc:date>2023-02-20T05:52:33Z</dc:date>
    <item>
      <title>How to subtotal in matrix with lookup values in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtotal-in-matrix-with-lookup-values-in-measure/m-p/3087142#M107974</link>
      <description>&lt;P&gt;I need some help in summing/subtotalling a column of values that are made up of a measure which does a lookupvalue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a matrix report. In it are grouped projects and tasks within each project. I created a measure that does a lookupvalue to get the budgeted hours for each of those tasks based on the project name/task name. That seems to work fine. However subtotalling at the project level does not and also there is no grand total. The lookupvalue doesn't make sense to do at a project level without a task name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column Budgeted Hours is this measure:&lt;/P&gt;&lt;P&gt;budgethourlookupt = if(ISINSCOPE(cr7e9_timesheet[Program Task]), LOOKUPVALUE(cr7e9_programtasks[Budget Hours],cr7e9_programtasks[cr7e9_program],selectedvalue(cr7e9_timesheet[cr7e9_program]),cr7e9_programtasks[Name],SELECTEDVALUE(cr7e9_timesheet[Name 2]),0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure what to put in when it's not in scope (at the project level) that would represent what the subtotal of the project's tasks budgeted hours are.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imagine if the subtotals can be figured out then the grand total will naturally appear (or I'll have to use the HASONEVALUE to determine when to do a grand total).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope someone can hep me figure this out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;</description>
      <pubDate>Mon, 20 Feb 2023 05:52:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtotal-in-matrix-with-lookup-values-in-measure/m-p/3087142#M107974</guid>
      <dc:creator>simontam</dc:creator>
      <dc:date>2023-02-20T05:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtotal in matrix with lookup values in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtotal-in-matrix-with-lookup-values-in-measure/m-p/3087145#M107975</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="517441" data-lia-user-login="simontam" class="lia-mention lia-mention-user"&gt;simontam&lt;/a&gt; , Try like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;budgethourlookupt = Sumx( values(cr7e9_timesheet[Program Task]) ,calculate(&amp;nbsp; if(ISINSCOPE(cr7e9_timesheet[Program Task]), LOOKUPVALUE(cr7e9_programtasks[Budget Hours],cr7e9_programtasks[cr7e9_program],selectedvalue(cr7e9_timesheet[cr7e9_program]),cr7e9_programtasks[Name],SELECTEDVALUE(cr7e9_timesheet[Name 2]),0)) ) )&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 05:54:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtotal-in-matrix-with-lookup-values-in-measure/m-p/3087145#M107975</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-02-20T05:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtotal in matrix with lookup values in measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtotal-in-matrix-with-lookup-values-in-measure/m-p/3087203#M107978</link>
      <description>&lt;P&gt;Ok you were very close, I had to modify your formula a bit (removed the IF(INSCOPE...), perhaps you meant that. Doing that the results are now subtotalling like I wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the super fast response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;budgethourlookupt = SUMX(VALUES(cr7e9_timesheet[cr7e9_programtask]), CALCULATE(LOOKUPVALUE(cr7e9_programtasks[Budget Hours],cr7e9_programtasks[cr7e9_program],SELECTEDVALUE(cr7e9_timesheet[cr7e9_program]),cr7e9_programtasks[Name],SELECTEDVALUE(cr7e9_timesheet[Name 2]),0)))&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;</description>
      <pubDate>Mon, 20 Feb 2023 06:37:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-subtotal-in-matrix-with-lookup-values-in-measure/m-p/3087203#M107978</guid>
      <dc:creator>simontam</dc:creator>
      <dc:date>2023-02-20T06:37:20Z</dc:date>
    </item>
  </channel>
</rss>

