<?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: Userelationship for multiple dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4283476#M170010</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for sending on, however this didn't work. I can see the stage options available for the relevant week but the table is blank when I add the measure&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Nov 2024 08:28:34 GMT</pubDate>
    <dc:creator>EltonjohnWick</dc:creator>
    <dc:date>2024-11-14T08:28:34Z</dc:date>
    <item>
      <title>Userelationship for multiple dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4282564#M169960</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this dax that works for filtering lending to drawn on a table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Drawn Deals =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;COUNTROWS(Lending), -- Or any other aggregation you'd like&lt;BR /&gt;USERELATIONSHIP(Lending[Drawn Date], DateHierarchy[Date]),&lt;BR /&gt;DateHierarchy[WeekNum] = SELECTEDVALUE(DateHierarchy[WeekNum])&lt;BR /&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;What I need is a combined code that also looks at lead, approved and declined. These stages have a slicer to flip between them, which I need to trigger to the lookup on the relevant date ie if column stage slicer is lead then look at lead date, if slicer is approved look at approved date. The slicer is a week output but it's linked to date table to pull the week though. Lead is the active relationship to the date table while the others are inactive linked to the date table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 21:59:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4282564#M169960</guid>
      <dc:creator>EltonjohnWick</dc:creator>
      <dc:date>2024-11-13T21:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Userelationship for multiple dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4282625#M169963</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608357" data-lia-user-login="EltonjohnWick" class="lia-mention lia-mention-user"&gt;EltonjohnWick&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please try the following approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Drawn Deals =
VAR SelectedStage = SELECTEDVALUE(StageSlicer[Stage])
RETURN
    SWITCH(
        SelectedStage,
        
        "Lead",
        CALCULATE(
            COUNTROWS(Lending),
            DateHierarchy[WeekNum] = SELECTEDVALUE(DateHierarchy[WeekNum])
        ),
        
        "Approved",
        CALCULATE(
            COUNTROWS(Lending),
            USERELATIONSHIP(Lending[Approved Date], DateHierarchy[Date]),
            DateHierarchy[WeekNum] = SELECTEDVALUE(DateHierarchy[WeekNum])
        ),
        
        "Declined",
        CALCULATE(
            COUNTROWS(Lending),
            USERELATIONSHIP(Lending[Declined Date], DateHierarchy[Date]),
            DateHierarchy[WeekNum] = SELECTEDVALUE(DateHierarchy[WeekNum])
        ),
        
        "Drawn",
        CALCULATE(
            COUNTROWS(Lending),
            USERELATIONSHIP(Lending[Drawn Date], DateHierarchy[Date]),
            DateHierarchy[WeekNum] = SELECTEDVALUE(DateHierarchy[WeekNum])
        ),
        
        BLANK()
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 23:12:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4282625#M169963</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2024-11-13T23:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Userelationship for multiple dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4283476#M170010</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for sending on, however this didn't work. I can see the stage options available for the relevant week but the table is blank when I add the measure&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 08:28:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4283476#M170010</guid>
      <dc:creator>EltonjohnWick</dc:creator>
      <dc:date>2024-11-14T08:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Userelationship for multiple dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4283772#M170022</link>
      <description>&lt;P&gt;This seems like a perfect use case for a calculation group. Create a base measure as&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Num deals = COUNTROWS( Lending )&lt;/LI-CODE&gt;
&lt;P&gt;and then create a calculation group with items like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Lead Deals = SELECTEDMEASURE()

Drawn Deals =
CALCULATE (
    SELECTEDMEASURE(),
    -- Or any other aggregation you'd like
    USERELATIONSHIP ( Lending[Drawn Date], DateHierarchy[Date] )
)
&lt;/LI-CODE&gt;
&lt;P&gt;You don't need to manipulate the relationship for the Lead calculation item because that relationship is already active. And you don't need the SELECTEDVALUE as that filter is already being applied.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 10:30:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4283772#M170022</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-11-14T10:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Userelationship for multiple dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4285334#M170095</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608357" data-lia-user-login="EltonjohnWick" class="lia-mention lia-mention-user"&gt;EltonjohnWick&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need create stage column as table slicer and then try to create formula like below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Drawn Deals1 =
VAR SelectedStage =
    SELECTEDVALUE ( StageSlicer[Stage] )
RETURN
    SWITCH (
        TRUE (),
        SelectedStage = "Lead",
            CALCULATE (
                COUNTROWS ( Lending ),
                TREATAS ( VALUES ( DateHierarchy[Date] ), Lending[Lead Date] ),
                DateHierarchy[WeekNum] = SELECTEDVALUE ( DateHierarchy[WeekNum] )
            ),
        SelectedStage = "Approved",
            CALCULATE (
                COUNTROWS ( Lending ),
                TREATAS ( VALUES ( DateHierarchy[Date] ), Lending[Approved Date] ),
                DateHierarchy[WeekNum] = SELECTEDVALUE ( DateHierarchy[WeekNum] )
            ),
        SelectedStage = "Declined",
            CALCULATE (
                COUNTROWS ( Lending ),
                TREATAS ( VALUES ( DateHierarchy[Date] ), Lending[Declined Date] ),
                DateHierarchy[WeekNum] = SELECTEDVALUE ( DateHierarchy[WeekNum] )
            ),
        CALCULATE (
            COUNTROWS ( Lending ),
            TREATAS ( VALUES ( DateHierarchy[Date] ), Lending[Drawn Date] ),
            DateHierarchy[WeekNum] = SELECTEDVALUE ( DateHierarchy[WeekNum] )
        )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Adamk Kong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 06:10:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4285334#M170095</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-15T06:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Userelationship for multiple dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4292881#M170356</link>
      <description>&lt;P&gt;Thank you so much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally works and saves me the visual clutter of having two different date slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 08:37:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Userelationship-for-multiple-dates/m-p/4292881#M170356</guid>
      <dc:creator>EltonjohnWick</dc:creator>
      <dc:date>2024-11-20T08:37:04Z</dc:date>
    </item>
  </channel>
</rss>

