<?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: SUM OF PREVIOUS columns , SAME ROW, conditional formating in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3446263#M131127</link>
    <description>&lt;P&gt;Thanks, it works&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Sep 2023 15:50:39 GMT</pubDate>
    <dc:creator>razieh12</dc:creator>
    <dc:date>2023-09-25T15:50:39Z</dc:date>
    <item>
      <title>SUM OF PREVIOUS columns , SAME ROW, conditional formating</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3433584#M130212</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently working on a task and would appreciate your assistance. I'm managing three cities, each with a fixed bicycle capacity. Additionally, there are eight bicycle stations, and the capacity of each station changes based on demand. The stations need to be filled in a sequential order within each city. If the total number of bicycles needed to fill the stations exceeds the capacity, I would like the respective station to be highlighted. When this occurs, the city's capacity will be filled to its maximum.&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create this matrix in the Powerbi matrix . Rows are City name and Capacity.&lt;/P&gt;&lt;P&gt;And column is Stations. And value is “number of requests”.&lt;/P&gt;&lt;P&gt;Given the sequential nature of station filling, for instance, if 12+13 exceeds 20 for Station B in City 1, I wish to have Station B highlighted. Additionally, when we fill Station B, the city's capacity is replenished back to 20. Consequently, in Station E, we might encounter a shortage again, as 10+7+15 would be greater than or equal to 20.&lt;/P&gt;&lt;P&gt;Similarly, in City 2, if 7+1+4 exceeds 12 for Station C, I desire to highlight Station C. Likewise, Station G should be highlighted if 3+2+3+5 surpasses 12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 21:57:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3433584#M130212</guid>
      <dc:creator>razieh12</dc:creator>
      <dc:date>2023-09-15T21:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: SUM OF PREVIOUS columns , SAME ROW, conditional formating</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3437175#M130441</link>
      <description>&lt;LI-CODE lang="markup"&gt;Similarly, in City 2, if 7+1+4 exceeds 12 for Station C,&lt;/LI-CODE&gt;
&lt;P&gt;It doesn't exceed 12.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2023 22:46:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3437175#M130441</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-09-18T22:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: SUM OF PREVIOUS columns , SAME ROW, conditional formating</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3441487#M130744</link>
      <description>&lt;P&gt;it is greater than or equal 12&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 12:11:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3441487#M130744</guid>
      <dc:creator>razieh12</dc:creator>
      <dc:date>2023-09-21T12:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: SUM OF PREVIOUS columns , SAME ROW, conditional formating</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3442196#M130791</link>
      <description>&lt;P&gt;There is an issue with City3 - the mark should be on station G, not H.&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("i45Wcs4sqTRU0lEyMgAShkYgwhhEgLjmIIYpkLAAMcACsToQLUYw1eZQKRMgBmk0gtKmYHGYcmOoISZQFSZQXUZIuoCqYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [City = _t, Capacity = _t, A = _t, B = _t, C = _t, D = _t, E = _t, F = _t, G = _t, H = _t]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"City", "Capacity"}, "Station", "Reported"),
    #"Changed Type" = Table.TransformColumnTypes(#"Unpivoted Other Columns",{{"Capacity", Int64.Type}, {"Reported", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"City"}, {{"Rows", each _, type table [City=nullable text, Capacity=nullable number, Station=text, Reported=nullable number]}}),
    Compute = (tbl)=&amp;gt; let
        #"Added Index" = Table.AddIndexColumn(tbl, "Index", 0, 1, Int64.Type),
        #"Added Custom" = Table.AddColumn(#"Added Index", "Full", each List.Accumulate({0..[Index]},[cumul=0],(state,current)=&amp;gt;[ cumul = if #"Added Index"[Capacity]{current}&amp;lt;=state[cumul] + #"Added Index"[Reported]{current} then  0 else state[cumul] + #"Added Index"[Reported]{current}]))
    in #"Added Custom",
    AddedCompute = Table.AddColumn(#"Grouped Rows","comp",each Compute([Rows])),
    #"Expanded comp" = Table.ExpandTableColumn(AddedCompute, "comp", {"Capacity", "Station", "Reported", "Full"}, {"Capacity", "Station", "Reported", "Full"}),
    #"Expanded Full" = Table.ExpandRecordColumn(#"Expanded comp", "Full", {"cumul"}, {"cumul"}),
    #"Removed Other Columns" = Table.SelectColumns(#"Expanded Full",{"City", "Capacity", "Station", "Reported", "cumul"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Removed Other Columns",{{"Capacity", Int64.Type}, {"Station", type text}, {"Reported", Int64.Type}, {"cumul", Int64.Type}})
in
    #"Changed Type1"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".&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 yellow mark is equivalent to cumul=0&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2023 00:18:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3442196#M130791</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-09-22T00:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: SUM OF PREVIOUS columns , SAME ROW, conditional formating</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3446263#M131127</link>
      <description>&lt;P&gt;Thanks, it works&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 15:50:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-OF-PREVIOUS-columns-SAME-ROW-conditional-formating/m-p/3446263#M131127</guid>
      <dc:creator>razieh12</dc:creator>
      <dc:date>2023-09-25T15:50:39Z</dc:date>
    </item>
  </channel>
</rss>

