<?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: how to work with two fact tables? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1657962#M33763</link>
    <description>&lt;P&gt;In additions I implemented the solution for you. Below the calculated table (first disconnect Days and then calculate table!)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;extraTable = 
VAR __cartesian = ALL(Salery[EMP Number],Salery[Month], Salery[Location])
VAR __tableWithAllocatedDays = 
ADDCOLUMNS(
    __cartesian,
    "@AllocatedDays",
    DIVIDE(
        SUMX(FILTER(Salery, Salery[EMP Number] = EARLIER(Salery[EMP Number]) &amp;amp;&amp;amp; Salery[Month] = EARLIER(Salery[Month]) &amp;amp;&amp;amp; Salery[Location] = EARLIER(Salery[Location])), Salery[Daily salery]),
        SUMX(FILTER(Salery, Salery[EMP Number] = EARLIER(Salery[EMP Number]) &amp;amp;&amp;amp; Salery[Month] = EARLIER(Salery[Month])), Salery[Daily salery])
    ) *
    SUMX(FILTER('Days at work', 'Days at work'[Emp Number] = EARLIER(Salery[EMP Number]) &amp;amp;&amp;amp; 'Days at work'[Month] = EARLIER(Salery[Month])),'Days at work'[Days])
)


RETURN
__tableWithAllocatedDays&lt;/LI-CODE&gt;&lt;P&gt;Giving this visual:&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Feb 2021 14:40:04 GMT</pubDate>
    <dc:creator>JW_van_Holst</dc:creator>
    <dc:date>2021-02-10T14:40:04Z</dc:date>
    <item>
      <title>how to work with two fact tables?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1656934#M33728</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I need some help to understand how I should work with two fact tables that does not have all the dimensions in each fact table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have uploaded an example pbix so you can easily try it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Link to pbix:&lt;/P&gt;&lt;P&gt;&lt;A href="https://ingraphic-my.sharepoint.com/:u:/g/personal/christian_fosund_ingraphic_no/EVhFayxBJoZHqa7Mu9GCArsBig-E_HQbaoFXtl2lbuFN5Q?e=lXg6J1" target="_blank" rel="noopener"&gt;https://ingraphic-my.sharepoint.com/:u:/g/personal/christian_fosund_ingraphic_no/EVhFayxBJoZHqa7Mu9GCArsBig-E_HQbaoFXtl2lbuFN5Q?e=lXg6J1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to calculate the total salery amount based on days worked and the daily salery.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The model should also allow me to filter by location, salery type and month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue I meet is that I don't have the location in the days worked table. I only know how many days they have worked. So when create a table it will not filter out Lisa who has not worked at Building 1. What is the best way of solving this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to create a measure that allows me to calculate the totalt salery correctly or maybe create one fact table with the days worked, and still be able to filter by location and salery type?&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;the wanted output in the example shold be:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Namedaily salerydays workedSallery total&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Christian&lt;/TD&gt;&lt;TD&gt;1700,95&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;39121,85&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Scot&lt;/TD&gt;&lt;TD&gt;1882,45&lt;/TD&gt;&lt;TD&gt;27&lt;/TD&gt;&lt;TD&gt;50826,15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;3583,4&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;179170&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 10 Feb 2021 08:36:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1656934#M33728</guid>
      <dc:creator>cfosund</dc:creator>
      <dc:date>2021-02-10T08:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with two fact tables?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1657706#M33753</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Allocate the Days to a location on basis of the weighted average of Daily Salary per Location. So EMP number 1 will have the Days allocated for 99.9% to location 1 and for 0.1% to location 2.&lt;BR /&gt;Make a new table with these allocations, disconnect the old Days table and connect the new one to the dimension tables (including Locations).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Good luck!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 12:58:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1657706#M33753</guid>
      <dc:creator>JW_van_Holst</dc:creator>
      <dc:date>2021-02-10T12:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with two fact tables?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1657962#M33763</link>
      <description>&lt;P&gt;In additions I implemented the solution for you. Below the calculated table (first disconnect Days and then calculate table!)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;extraTable = 
VAR __cartesian = ALL(Salery[EMP Number],Salery[Month], Salery[Location])
VAR __tableWithAllocatedDays = 
ADDCOLUMNS(
    __cartesian,
    "@AllocatedDays",
    DIVIDE(
        SUMX(FILTER(Salery, Salery[EMP Number] = EARLIER(Salery[EMP Number]) &amp;amp;&amp;amp; Salery[Month] = EARLIER(Salery[Month]) &amp;amp;&amp;amp; Salery[Location] = EARLIER(Salery[Location])), Salery[Daily salery]),
        SUMX(FILTER(Salery, Salery[EMP Number] = EARLIER(Salery[EMP Number]) &amp;amp;&amp;amp; Salery[Month] = EARLIER(Salery[Month])), Salery[Daily salery])
    ) *
    SUMX(FILTER('Days at work', 'Days at work'[Emp Number] = EARLIER(Salery[EMP Number]) &amp;amp;&amp;amp; 'Days at work'[Month] = EARLIER(Salery[Month])),'Days at work'[Days])
)


RETURN
__tableWithAllocatedDays&lt;/LI-CODE&gt;&lt;P&gt;Giving this visual:&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 14:40:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1657962#M33763</guid>
      <dc:creator>JW_van_Holst</dc:creator>
      <dc:date>2021-02-10T14:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to work with two fact tables?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1658499#M33780</link>
      <description>&lt;P&gt;Thanks you so much! You saved my week and I learned alot 🤩&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 18:38:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-work-with-two-fact-tables/m-p/1658499#M33780</guid>
      <dc:creator>cfosund</dc:creator>
      <dc:date>2021-02-10T18:38:28Z</dc:date>
    </item>
  </channel>
</rss>

