<?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: Weighed Value based on availability in given period in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2976259#M99652</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403972" data-lia-user-login="v-jianboli-msft" class="lia-mention lia-mention-user"&gt;v-jianboli-msft&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your answer again. Its much appriciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try to explain my self better.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got 48 locations. Im useing a year and week slicer to find what activies are going on, across all locations, in the given timeperiod. This gives me the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Each activity has a contracter related to it (Con1, Con2 and Con3 in the above), a unique ID (Even though they have the same name) and a weight. I need a measure that will find the activity with the lowest weight based on location and return the contracter related and return blank on activities with a higher weight in the same location. On the following picture im trying to descripe that. The yellow column is the measure I need.&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;Below is a picture of my data model:&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 hope this explains it better. If not, I will send you the pbix file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2022 11:06:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-12-19T11:06:53Z</dc:date>
    <item>
      <title>Weighed Value based on availability in given period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2971166#M99302</link>
      <description>&lt;P&gt;Hello everyone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im looking for a dax formula that can provide me with the yellow column in the below picture, but I dont have the dax brain to figure out how to formulate it. I need to use this in either a measure or column in Power BI. I have all the data formatted green.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to allocate a role to a location based on the weight i've set. So if weigh 1 is available in the given week it will return that in the corresponding column and leave nothing in the rest of the given columns in that location.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 14:58:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2971166#M99302</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-15T14:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Weighed Value based on availability in given period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2972192#M99389</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, you only mention that the corresponding role is returned at a weight of 1, but in the figure you provided, it seems that the role is also returned at a weight of 6. What is the exact logic of its calculation?&lt;BR /&gt;If it is the case that the corresponding role is returned when the weight is minimal, please try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
var _a = CALCULATE(MIN('Table'[Weigh]),ALLEXCEPT('Table','Table'[Week],'Table'[Location]))
return IF(MAX('Table'[Weigh])=_a,MAX('Table'[Role]),BLANK())&lt;/LI-CODE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If not, please clarify the calculation logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 02:16:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2972192#M99389</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2022-12-16T02:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Weighed Value based on availability in given period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2973219#M99460</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403972" data-lia-user-login="v-jianboli-msft" class="lia-mention lia-mention-user"&gt;v-jianboli-msft&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your answer!&lt;/P&gt;&lt;P&gt;You are right about the logic is wrong in the figure I provided. Sorry about that.&lt;BR /&gt;If the same name are in two locations, it would have same weigh. In the example I provided the names should have been NameD, Name E and Name F in location B. Im not sure if that changes anything about the measure you made?&lt;BR /&gt;&lt;BR /&gt;I've had a look at your pbix and that work as intened. However I can't get it to work with my own data. Is that because im getting data from different tabels?&lt;BR /&gt;&lt;BR /&gt;I get my data from:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Week(Uge) - DimTid&lt;BR /&gt;Name(Navn) - AstaData&lt;/P&gt;&lt;P&gt;Location - AstaData&lt;/P&gt;&lt;P&gt;Role (Entreprenør) - AstaData&lt;/P&gt;&lt;P&gt;Weigh - Logistik aktiviteter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The tables got relations between eachother.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;But when I insert the measure it doesen't work.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
var _a = CALCULATE(MIN('Logistik Aktiviteter'[Weight]),ALLEXCEPT(AstaData,DimTid[Uge],AstaData[Lokation]))
return IF(MAX('Logistik Aktiviteter'[Weight])=_a,MAX(AstaData[Entreprenør]),blank())&lt;/LI-CODE&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;Best regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 10:59:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2973219#M99460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-16T10:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Weighed Value based on availability in given period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2976093#M99645</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry, still don't quite understand the logic of your calculation, can you explain it in more detail? Or is my understanding correct? You mentioned that all three tables have relationships with each other, so what kind of relationships do they have and which fields do they rely on to establish the relationships?&lt;/P&gt;
&lt;P&gt;Sorry for that the information you have provided is not making the problem clear to me. Can you please share more details to help us clarify your scenario?&lt;/P&gt;
&lt;P&gt;Please provide me with more details about your table and your problem or share me with your pbix file after&amp;nbsp;&lt;STRONG&gt;removing sensitive data.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer to:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-provide-sample-data-in-the-Power-BI-Forum%2Fba-p%2F963216&amp;amp;data=05%7C01%7Cv-jianboli%40microsoft.com%7Ca7ce12be0f454896a61208da8034281b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637963258750159993%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=orVyE0%2FImc2MEFUqXtCveK0uf33594f67ZDxb8ybuNI%3D&amp;amp;reserved=0" target="_blank"&gt;How to provide sample data in the Power BI Forum&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.powerbi.com%2Ft5%2FCommunity-Blog%2FHow-to-Get-Your-Question-Answered-Quickly%2Fba-p%2F38490&amp;amp;data=05%7C01%7Cv-jianboli%40microsoft.com%7Ca7ce12be0f454896a61208da8034281b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637963258750159993%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;amp;sdata=XocTq9o6TjxbxJqTak20E3kKp7q5HxKTNZef7xESMV0%3D&amp;amp;reserved=0" target="_blank"&gt;How to Get Your Question Answered Quickly&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 08:40:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2976093#M99645</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2022-12-19T08:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Weighed Value based on availability in given period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2976259#M99652</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403972" data-lia-user-login="v-jianboli-msft" class="lia-mention lia-mention-user"&gt;v-jianboli-msft&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your answer again. Its much appriciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try to explain my self better.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got 48 locations. Im useing a year and week slicer to find what activies are going on, across all locations, in the given timeperiod. This gives me the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Each activity has a contracter related to it (Con1, Con2 and Con3 in the above), a unique ID (Even though they have the same name) and a weight. I need a measure that will find the activity with the lowest weight based on location and return the contracter related and return blank on activities with a higher weight in the same location. On the following picture im trying to descripe that. The yellow column is the measure I need.&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;Below is a picture of my data model:&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 hope this explains it better. If not, I will send you the pbix file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 11:06:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2976259#M99652</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-19T11:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Weighed Value based on availability in given period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2978159#M99770</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I have created a simple sample(for more details, please refer to the PBIX file):&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Please try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _a =
    SELECTCOLUMNS ( 'DimTid', "Date", [Date] )
VAR _b =
    MAX ( 'AstaData'[Location] )
VAR _c =
    ADDCOLUMNS (
        FILTER ( ALL ( AstaData ), [Date] IN _a &amp;amp;&amp;amp; [Location] = _b ),
        "WEIGHT",
            MAXX (
                FILTER ( ALL ( 'Logistik aktiviteter' ), [ID] = EARLIER ( AstaData[ID] ) ),
                [Weight]
            )
    )
VAR _d =
    MINX ( _c, [WEIGHT] )
RETURN
    IF ( MAX ( 'Logistik aktiviteter'[Weight] ) = _d, MAX ( 'AstaData'[Role] ) )
&lt;/LI-CODE&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 06:31:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2978159#M99770</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2022-12-20T06:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Weighed Value based on availability in given period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2980966#M99926</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="403972" data-lia-user-login="v-jianboli-msft" class="lia-mention lia-mention-user"&gt;v-jianboli-msft&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks. That did the trick.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Appriciate the help.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 07:52:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Weighed-Value-based-on-availability-in-given-period/m-p/2980966#M99926</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-21T07:52:59Z</dc:date>
    </item>
  </channel>
</rss>

