<?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: Show initial value in Dax based on several conditions in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4253626#M168491</link>
    <description>&lt;P&gt;Thank you very much for your help ! Works perfectly !&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2024 06:12:09 GMT</pubDate>
    <dc:creator>Dimi_2207</dc:creator>
    <dc:date>2024-10-23T06:12:09Z</dc:date>
    <item>
      <title>Show initial value in Dax based on several conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4251509#M168354</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you, please, help me with the following topic.&lt;/P&gt;&lt;P&gt;I have data of calls where i can see if the call is the repeated one (based on phone number) within 7 days.&lt;/P&gt;&lt;P&gt;For example, initial call from phone number 333333 happened on 09.09&lt;/P&gt;&lt;P&gt;second and third on 14.09 (5 days later) and&lt;/P&gt;&lt;P&gt;next one on 18.09. (4 days later). All these calls wich followed initial one are considered to be repeated in 7 days rolling cycle.&lt;/P&gt;&lt;P&gt;Another one from the same number happened 01.10 (that is 13 days later from the previous - so it's not a continuation of 7 days rolling cycle).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a help with the last column - to display in DAX originator of the first call (initial agent) who triggered 7 days repeated calls cycle.&lt;/P&gt;&lt;P&gt;Please, see table below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your support on this matter!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Phone number&lt;/TD&gt;&lt;TD&gt;Call date and time&lt;/TD&gt;&lt;TD&gt;Days between call attempts from the same phone numbers&lt;/TD&gt;&lt;TD&gt;Count of call attempt if previous call happened in past 7 days&lt;/TD&gt;&lt;TD&gt;Repeated within 7 days period?&lt;/TD&gt;&lt;TD&gt;Agent&lt;/TD&gt;&lt;TD&gt;Previous call date-time if previous call happened in past 7 days&lt;/TD&gt;&lt;TD&gt;Previous agent&amp;nbsp; if previous call happened in past 7 days&lt;/TD&gt;&lt;TD&gt;Initial agent who handled 1st call&amp;nbsp; if previous call happened in past 7 days&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111111&lt;/TD&gt;&lt;TD&gt;02-09-24 09:25&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;Pieter&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222222&lt;/TD&gt;&lt;TD&gt;06-09-24 10:51&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;Ivan&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;333333&lt;/TD&gt;&lt;TD&gt;09-09-24 14:37&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&g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&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;333333&lt;/TD&gt;&lt;TD&gt;01-10-24 11:43&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;N&lt;/TD&gt;&lt;TD&gt;Ivan&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 21 Oct 2024 22:37:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4251509#M168354</guid>
      <dc:creator>Dimi_2207</dc:creator>
      <dc:date>2024-10-21T22:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Show initial value in Dax based on several conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4251537#M168356</link>
      <description>&lt;P&gt;Your sample data is insufficient to provide a proper solution.&amp;nbsp; Here's a starting point for 333333&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;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hZHBbsMgEER/BXGOJTBgMLeovfQQKVKPVg60WdVIDqlc2u8vrAuOU1Wd4+ixs8wOAz2O1wAkfF5eYKY7+uCmiZxdBOLCmUR/gWTu3yBEetoNlKOSxdqG9U0rCettq5Jx9BBhJki1qEx1PxRnVuVnT18uICJQGekLIq3QyXiO8D66AIhJVHI5K5iyyuRJs/9Y0hQqM7ww3Io+GQc3eyDbPC7XQZL/Cxmr9CatQ2Wm/k1b/OxmcY3KmF4rEOyvPHOzVN788ZqgsFAGlcy2Wymx7aAyovTEzK+4uhPjTepzOR5n96vXWbeYzAUf/OvoYLo7YKFS61LUG5++AQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).5" = _t]),
    #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Call date and time", type datetime}},"nl"),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Phone number"}, {{"Rows", each _, type table [Phone number=nullable text, Call date and time=nullable datetime, Agent=nullable text]}}),
    #"333333" = #"Grouped Rows"{[#"Phone number"="333333"]}[Rows],
    #"Sorted Rows" = Table.Sort(#"333333",{{"Call date and time", Order.Ascending}}),
    #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1, Int64.Type),
    #"Added Custom" = Table.AddColumn(#"Added Index", "Days Between", each if [Index]=0 then null else Number.From([Call date and time]-#"Added Index"[Call date and time]{[Index]-1}), type number),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Calls in Last 7 Days", (k)=&amp;gt; Table.RowCount(Table.SelectRows(#"Added Index",each [Call date and time]&amp;lt;=k[Call date and time] and [Call date and time]&amp;gt;=k[Call date and time]-#duration(7,0,0,0))),Int64.Type),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Previous Call in Last 7 Days", each if ([Days Between] ?? 8 ) &amp;lt;=7 then #"Added Custom"[Call date and time]{[Index]-1} else null, type datetime),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "Previous Agent if in past 7 days", each if ([Days Between] ?? 8 ) &amp;lt;=7 then #"Added Custom"[Agent]{[Index]-1} else null,type text),
    #"Added Custom4" = Table.AddColumn(#"Added Custom3", "Initial Agent", each List.Accumulate({0..[Index]},#"Added Index"{0}[Agent],(state,current)=&amp;gt; if (#"Added Custom"[Days Between]{current} ?? 0 ) &amp;lt;=7 then state else null),type text)
in
    #"Added Custom4"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data &lt;STRONG&gt;that fully covers your issue&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 23:55:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4251537#M168356</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-10-21T23:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Show initial value in Dax based on several conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4251876#M168371</link>
      <description>&lt;P&gt;Thank you very much for the proposed code!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please, accept, extended sample with more data in excel:&amp;nbsp;&lt;A href="https://docs.google.com/spreadsheets/d/1MogqRB-GIkEvPV0iMJu0S_-RoKqN8AWA/edit?usp=sharing&amp;amp;ouid=103257556235011271010&amp;amp;rtpof=true&amp;amp;sd=true" target="_blank"&gt;https://docs.google.com/spreadsheets/d/1MogqRB-GIkEvPV0iMJu0S_-RoKqN8AWA/edit?usp=sharing&amp;amp;ouid=103257556235011271010&amp;amp;rtpof=true&amp;amp;sd=true&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you, please, help so it works with this bigger sample and different phone numbers?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you !!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 05:08:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4251876#M168371</guid>
      <dc:creator>Dimi_2207</dc:creator>
      <dc:date>2024-10-22T05:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Show initial value in Dax based on several conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4252618#M168424</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Excel.Workbook(File.Contents("C:\Users\xxx\Downloads\Extended Sample.xlsx"), null, true),
    Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Phone number", type text}, {"Call date and time", type datetime}, {"Agent", type text}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Phone number] &amp;lt;&amp;gt; null),
    Processed = (tbl) =&amp;gt; let 
        #"Sorted Rows" = Table.Sort(tbl,{{"Call date and time", Order.Ascending}}),
        #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1, Int64.Type),
        #"Added Custom" = Table.AddColumn(#"Added Index", "Days Between", each if [Index]=0 then null else Number.From([Call date and time]-#"Added Index"[Call date and time]{[Index]-1}),type number),
        #"Added Custom1" = Table.AddColumn(#"Added Custom", "Calls in Past 7", (k)=&amp;gt; Table.RowCount(Table.SelectRows(#"Added Index",each [Call date and time]&amp;lt;=k[Call date and time] and [Call date and time]&amp;gt;=k[Call date and time]-#duration(7,0,0,0))), Int64.Type),
        #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Previous Call in Past 7", each if ([Days Between] ?? 8 ) &amp;lt;=7 then #"Added Custom"[Call date and time]{[Index]-1} else null, type datetime),
        #"Added Custom3" = Table.AddColumn(#"Added Custom2", "Previous Agent in Past 7", each if ([Days Between] ?? 8 ) &amp;lt;=7 then #"Added Custom"[Agent]{[Index]-1} else null, type text),
        #"Added Custom4" = Table.AddColumn(#"Added Custom3", "Initial Agent", each List.Accumulate({0..[Index]},#"Added Index"{0}[Agent],(state,current)=&amp;gt; if (#"Added Custom"[Days Between]{current} ?? 0 ) &amp;lt;=7 then state else null))
    in
        #"Added Custom4",
    #"Grouped Rows" = Table.Group(#"Filtered Rows", {"Phone number"}, {{"Rows", each _, type table [Phone number=nullable text, Call date and time=nullable datetime, Agent=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Processed([Rows])),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Phone number", "Custom"}),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"Call date and time", "Agent", "Days Between", "Calls in Past 7", "Previous Call in Past 7", "Previous Agent in Past 7", "Initial Agent"}, {"Call date and time", "Agent", "Days Between", "Calls in Past 7", "Previous Call in Past 7", "Previous Agent in Past 7", "Initial Agent"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Call date and time", type datetime}})
in
    #"Changed Type1"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note :&amp;nbsp; you need to filter out all the empty rows!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please explain how you would want to handle 15615. Who would be the Initial Agent? Still Katty? Or Dorien?&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;</description>
      <pubDate>Tue, 22 Oct 2024 17:51:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4252618#M168424</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-10-22T17:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Show initial value in Dax based on several conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4252954#M168439</link>
      <description>&lt;P&gt;In this example - Dorien, because this call happened later than 7 days after the one that was handled by Katty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 18:09:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4252954#M168439</guid>
      <dc:creator>Dimi_2207</dc:creator>
      <dc:date>2024-10-22T18:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Show initial value in Dax based on several conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4253096#M168455</link>
      <description>&lt;LI-CODE lang="markup"&gt;let
    Source = Excel.Workbook(File.Contents("C:\Users\xx\Downloads\Extended Sample.xlsx"), null, true),
    Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Phone number", type text}, {"Call date and time", type datetime}, {"Agent", type text}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Phone number] &amp;lt;&amp;gt; null),
    #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each [Phone number] = "15615"),
    Processed = (tbl) =&amp;gt; let 
        #"Sorted Rows" = Table.Sort(tbl,{{"Call date and time", Order.Ascending}}),
        #"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 0, 1, Int64.Type),
        #"Added Custom" = Table.AddColumn(#"Added Index", "Days Between", each if [Index]=0 then null else Number.From([Call date and time]-#"Added Index"[Call date and time]{[Index]-1}),type number),
        #"Added Custom1" = Table.AddColumn(#"Added Custom", "Calls in Past 7", (k)=&amp;gt; Table.RowCount(Table.SelectRows(#"Added Index",each [Call date and time]&amp;lt;=k[Call date and time] and [Call date and time]&amp;gt;=k[Call date and time]-#duration(7,0,0,0))), Int64.Type),
        #"Added Custom2" = Table.AddColumn(#"Added Custom1", "Previous Call in Past 7", each if ([Days Between] ?? 8 ) &amp;lt;=7 then #"Added Custom"[Call date and time]{[Index]-1} else null, type datetime),
        #"Added Custom3" = Table.AddColumn(#"Added Custom2", "Previous Agent in Past 7", each if ([Days Between] ?? 8 ) &amp;lt;=7 then #"Added Custom"[Agent]{[Index]-1} else null, type text),
        #"Added Custom4" = Table.AddColumn(#"Added Custom3", "Initial Agent", each List.Accumulate({0..[Index]},#"Added Index"{0}[Agent],(state,current)=&amp;gt; if (#"Added Custom"[Days Between]{current} ?? 0 ) &amp;lt;=7 then state else #"Added Index"{current}[Agent]))
    in
        #"Added Custom4",
    #"Grouped Rows" = Table.Group(#"Filtered Rows1", {"Phone number"}, {{"Rows", each _, type table [Phone number=nullable text, Call date and time=nullable datetime, Agent=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Processed([Rows])),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Phone number", "Custom"}),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"Call date and time", "Agent", "Days Between", "Calls in Past 7", "Previous Call in Past 7", "Previous Agent in Past 7", "Initial Agent"}, {"Call date and time", "Agent", "Days Between", "Calls in Past 7", "Previous Call in Past 7", "Previous Agent in Past 7", "Initial Agent"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Expanded Custom",{{"Call date and time", type datetime}})
in
    #"Changed Type1"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Oct 2024 20:42:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4253096#M168455</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-10-22T20:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Show initial value in Dax based on several conditions</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4253626#M168491</link>
      <description>&lt;P&gt;Thank you very much for your help ! Works perfectly !&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 06:12:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-initial-value-in-Dax-based-on-several-conditions/m-p/4253626#M168491</guid>
      <dc:creator>Dimi_2207</dc:creator>
      <dc:date>2024-10-23T06:12:09Z</dc:date>
    </item>
  </channel>
</rss>

