<?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 check if one value of a combination of values has changed over time in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2582817#M74166</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for the code, it works and is almost perfect! But unfortunately not entirely as it needs to when I add more data to the dummy data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;As you can see in the example above, there's a blank value? This should have also been filled in with "Variable" as the combination (3, 40, 77) passed 20 days after it's first entry? We're getting close though, this is very promising and almost exactly what I need!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2022 10:09:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-06-16T10:09:26Z</dc:date>
    <item>
      <title>How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2575197#M73700</link>
      <description>&lt;P&gt;Hi Everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question for my fellow BI people. I'm gonna use dummy data to give an idea of our Power BI dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So we have a Fact table Invoices with many columns, but the most important ones for my questions are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Invoice Number&lt;/LI&gt;&lt;LI&gt;Worker Key&lt;/LI&gt;&lt;LI&gt;Customer Key&lt;/LI&gt;&lt;LI&gt;Date&lt;/LI&gt;&lt;LI&gt;IsPayroll?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;To give you a visual representation:&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My company wants a new column (based on a condition), that has 3 options; SET payroll, NO payroll, VARIABLE payroll.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They wanna know if a certain combination, for example above invoice nr 1 with customer key 20 and worker key 55, has changed it's value in the column "ispayroll" from "n" to "y" over the period of 20 days. If that's the case the new column must be set to "variable". If a combination starts out for the first time with "ispayroll" "Y" the new column value must be set to "Payroll set". If the&amp;nbsp; "ispayroll" column has a "n" value the&amp;nbsp;new column value must be set to "no payroll". So the result from the example above should be filled in like this:&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the condition must be checked based on the combination of Invoice Nr, Customer Key, Worker Key and Date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me? I know this might be a little difficult to understand, but any help is welcome!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 12:19:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2575197#M73700</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-13T12:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2575310#M73713</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column =
  VAR __Invoice = [Invoice number]
  VAR __Worker = [worker key]
  VAR __Customer = [customer key]
  VAR __Table = FILTER('Table',[Invoice number] = __Invoice &amp;amp;&amp;amp; [worker key] = __Worker &amp;amp;&amp;amp; [customer key] = __Customer)
  VAR __Count = COUNTROWS(DISTINCT(SELECTCOLUMNS(__Table,"__Payroll",[payroll?])))
  VAR __Payroll = MAXX(DISTINCT(SELECTCOLUMNS(__Table,"__Payroll",[payroll?])),[__Payroll])
RETURN
  SWITCH(TRUE(),
    __Count &amp;gt; 1, "Variable",
    __Payroll = "n", "No payroll",
    "Payroll set"
  )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 13 Jun 2022 13:08:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2575310#M73713</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-06-13T13:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2575765#M73752</link>
      <description>&lt;P&gt;Hey Greg!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for the quick response, I'll try the code out tomorrow!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 16:27:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2575765#M73752</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-13T16:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2582491#M74141</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try the following methods.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Result = 
IF (
    [payroll?] = "y"
        &amp;amp;&amp;amp; [date]
            = CALCULATE (
                MIN ( 'Table'[date] ),
                FILTER ( 'Table', [Invoice number] = EARLIER ( 'Table'[Invoice number] ) )
            ),
    "payroll set",
    IF (
        [payroll?] = "n"
            &amp;amp;&amp;amp; [date]
                = CALCULATE (
                    MIN ( 'Table'[date] ),
                    FILTER ( 'Table', [Invoice number] = EARLIER ( 'Table'[Invoice number] ) )
                ),
        "no payroll",
        IF (
            [payroll?] = "y"
                &amp;amp;&amp;amp; [date]
                    &amp;gt; CALCULATE (
                        MIN ( 'Table'[date] ),
                        FILTER ( 'Table', [Invoice number] = EARLIER ( 'Table'[Invoice number] ) )
                    ) + 20,
            "variable",
            IF ( [payroll?] = "n", "no payroll" )
        )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Is this the result you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 08:31:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2582491#M74141</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-06-16T08:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2582805#M74165</link>
      <description>&lt;P&gt;Sorry for the delay, I've been sick and haven't been able to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This doesn't work for my questions because it doesn't take in account the 20 day rule that is needed for the "Variable" payroll option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it is a nice start because it does a lot of things right! Maybe there's something we can do to add the 20 day rule to your code?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 10:04:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2582805#M74165</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-16T10:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2582817#M74166</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for the code, it works and is almost perfect! But unfortunately not entirely as it needs to when I add more data to the dummy data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;As you can see in the example above, there's a blank value? This should have also been filled in with "Variable" as the combination (3, 40, 77) passed 20 days after it's first entry? We're getting close though, this is very promising and almost exactly what I need!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 10:09:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2582817#M74166</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-16T10:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2583067#M74181</link>
      <description>&lt;P&gt;Also, the check has to be based off the combination of invoice number, worker key and customer key. If I add a new line with invoice number&amp;nbsp; 1 but with a different worker key and customer key, it fills it in with "Variable" as well, when in fact it should fill it in with 'Payroll Set':&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;So sorry, I know what I'm asking is very complicated!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 11:38:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2583067#M74181</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-16T11:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2591114#M74648</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can try the following methods.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Result =
IF (
    [payroll?] = "y"
        &amp;amp;&amp;amp; [date]
            = CALCULATE (
                MIN ( 'Table'[date] ),
                FILTER (
                    'Table',
                    [Invoice number] = EARLIER ( 'Table'[Invoice number] )
                        &amp;amp;&amp;amp; [Customer key] = EARLIER ( 'Table'[Customer key] )
                        &amp;amp;&amp;amp; [worker key] = EARLIER ( 'Table'[worker key] )
                )
            ),
    "payroll set",
    IF (
        [payroll?] = "n"
            &amp;amp;&amp;amp; [date]
                = CALCULATE (
                    MIN ( 'Table'[date] ),
                    FILTER (
                        'Table',
                        [Invoice number] = EARLIER ( 'Table'[Invoice number] )
                            &amp;amp;&amp;amp; [Customer key] = EARLIER ( 'Table'[Customer key] )
                            &amp;amp;&amp;amp; [worker key] = EARLIER ( 'Table'[worker key] )
                    )
                ),
        "no payroll",
        IF (
            [payroll?] = "y"
                &amp;amp;&amp;amp; [date]
                    &amp;gt;= CALCULATE (
                        MIN ( 'Table'[date] ),
                        FILTER (
                            'Table',
                            [Invoice number] = EARLIER ( 'Table'[Invoice number] )
                                &amp;amp;&amp;amp; [Customer key] = EARLIER ( 'Table'[Customer key] )
                                &amp;amp;&amp;amp; [worker key] = EARLIER ( 'Table'[worker key] )
                        )
                    ) + 20,
            "variable",
            IF ( [payroll?] = "n", "no payroll" )
        )
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;This time the formula is written based on the invoice number, the worker key and the customer key.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(3, 40, 77) obtained the correct value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As shown in the graph, (1,20,55) has been rejected for the first time after 20 days on March 1, shouldn't it be "variable"? If there are other conditions, please let me know.&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;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 05:54:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2591114#M74648</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-06-21T05:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2591501#M74664</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works! This is exactly what I needed, thanks!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And you're right, it should be "Variable" for that example, I highlighted the wrong row in my screenshot sorry. I meant to highlight the row above, which had the same invoice number, but different customer key and worker key. But that issue has been resolved with the new code you sent me so no worries!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm gonna try to implement this in our actual dataset and hopefully everything will work exactly as it does with the dummy data we used here!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 08:06:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/2591501#M74664</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-21T08:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to check if one value of a combination of values has changed over time</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/3813072#M149133</link>
      <description>&lt;P&gt;Hey Greg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to add the 20 days rule into account in this code? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2024 09:34:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-check-if-one-value-of-a-combination-of-values-has-changed/m-p/3813072#M149133</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-05T09:34:36Z</dc:date>
    </item>
  </channel>
</rss>

