<?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 use a result of a measure in another measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-a-result-of-a-measure-in-another-measure/m-p/3646171#M141207</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's my first post here. I hope this will find you well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've created a measure which calculates the percentage of the costs.&lt;/P&gt;&lt;P&gt;Now I want to use these percentages to calculate the Turnover per employee according to their costs. How can I use the result of&amp;nbsp; a measure in another measure?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Cost in % = 

VAR CurrentOrder = Values(expensepostings[order_id])
VAR CurrentSuborder = Values(expensepostings[suborder_id])
VAR TotalCosts =
SWITCH(
    TRUE(),
    ISINSCOPE(employees[display_name]), CALCULATE(SUM(expensepostings[cost_amount]), ALLSELECTED(expensepostings), expensepostings[order_id] IN CurrentOrder, expensepostings[suborder_id] in CurrentSuborder),
    ISINSCOPE(expensepostings[suborder_id]), CALCULATE(SUM(expensepostings[cost_amount]), ALLSELECTED(expensepostings), expensepostings[order_id] IN CurrentOrder),
    ISINSCOPE(expensepostings[order_id]), CALCULATE(SUM(expensepostings[cost_amount]),ALLSELECTED(expensepostings))
)
RETURN
IF(
    ISINSCOPE(expensepostings[order_id]),
        DIVIDE(expensepostings[Gesamtkosten], TotalCosts),
    1
)&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Depending on which level I am this measure will calculate the percentage of costs according to the order_id, the suborder_id or the employee name. The result on employee level is shown here:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have the percentages from each employee per suborder. I want to use these percentages to calculate the turnover for each employee per suborder.&amp;nbsp; In the order table I have the information that suborder 19790 has a turnover of 875. But I don't know how to use the calculated percentages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to excpect the turnover for each employee per suborder like this:&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;Does somebody has an idea how to do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 15:11:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-01-18T15:11:26Z</dc:date>
    <item>
      <title>How to use a result of a measure in another measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-a-result-of-a-measure-in-another-measure/m-p/3646171#M141207</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's my first post here. I hope this will find you well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've created a measure which calculates the percentage of the costs.&lt;/P&gt;&lt;P&gt;Now I want to use these percentages to calculate the Turnover per employee according to their costs. How can I use the result of&amp;nbsp; a measure in another measure?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Cost in % = 

VAR CurrentOrder = Values(expensepostings[order_id])
VAR CurrentSuborder = Values(expensepostings[suborder_id])
VAR TotalCosts =
SWITCH(
    TRUE(),
    ISINSCOPE(employees[display_name]), CALCULATE(SUM(expensepostings[cost_amount]), ALLSELECTED(expensepostings), expensepostings[order_id] IN CurrentOrder, expensepostings[suborder_id] in CurrentSuborder),
    ISINSCOPE(expensepostings[suborder_id]), CALCULATE(SUM(expensepostings[cost_amount]), ALLSELECTED(expensepostings), expensepostings[order_id] IN CurrentOrder),
    ISINSCOPE(expensepostings[order_id]), CALCULATE(SUM(expensepostings[cost_amount]),ALLSELECTED(expensepostings))
)
RETURN
IF(
    ISINSCOPE(expensepostings[order_id]),
        DIVIDE(expensepostings[Gesamtkosten], TotalCosts),
    1
)&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Depending on which level I am this measure will calculate the percentage of costs according to the order_id, the suborder_id or the employee name. The result on employee level is shown here:&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have the percentages from each employee per suborder. I want to use these percentages to calculate the turnover for each employee per suborder.&amp;nbsp; In the order table I have the information that suborder 19790 has a turnover of 875. But I don't know how to use the calculated percentages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to excpect the turnover for each employee per suborder like this:&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;Does somebody has an idea how to do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 15:11:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-a-result-of-a-measure-in-another-measure/m-p/3646171#M141207</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-18T15:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a result of a measure in another measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-a-result-of-a-measure-in-another-measure/m-p/3646938#M141246</link>
      <description>&lt;P&gt;You cannot measure a measure.&amp;nbsp; Implement your entire business logic in a single measure.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 01:09:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-use-a-result-of-a-measure-in-another-measure/m-p/3646938#M141246</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-01-19T01:09:06Z</dc:date>
    </item>
  </channel>
</rss>

