<?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: Calculate data for every week in matrix in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228110#M53124</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="312820" data-lia-user-login="DimaMD" class="lia-mention lia-mention-user"&gt;DimaMD&lt;/a&gt; , Having week and year in you table should help in that &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new columns like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1&lt;BR /&gt;Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)&lt;BR /&gt;Week Number = WEEKNUM([Date],2)&lt;BR /&gt;Week = if('Date'[Week Number]&amp;lt;10,'Date'[Year]*10 &amp;amp; 'Date'[Week Number],'Date'[Year]&amp;amp;'Date'[Week Number])&lt;BR /&gt;Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense) &lt;BR /&gt;Week name = [Week Start date] &amp;amp; " to "&amp;amp; [Week End date]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in case you need to compare&lt;/P&gt;
&lt;P&gt;Power BI — Week on Week and WTD &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=pnAesWxYgJ8" target="_blank"&gt;https://www.youtube.com/watch?v=pnAesWxYgJ8&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Dec 2021 15:33:25 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-12-08T15:33:25Z</dc:date>
    <item>
      <title>Calculate data for every week in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228001#M53114</link>
      <description>&lt;P&gt;Hello community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help. In our example we have three tables: sales, costs and budget. Sales table has data for every day, cost and budget both have data for 1 date, which means a plan for 1 month, so for that reason I made a mesure that calculate budget and costs for each day depends on quantity of days in month.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;How can we calculate budget and costs, so we can see results of weeks? As we can see on scrn2 table doesnt calculate this, instead we have empty cells&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Complete table has data for several years.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me do the right calculation to solve this task&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1msJo6d17e5R22WwQ86ZTkLA5rkLVEw_V/view?usp=sharing" target="_self"&gt;Example file&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 14:36:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228001#M53114</guid>
      <dc:creator>DimaMD</dc:creator>
      <dc:date>2021-12-08T14:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate data for every week in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228110#M53124</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="312820" data-lia-user-login="DimaMD" class="lia-mention lia-mention-user"&gt;DimaMD&lt;/a&gt; , Having week and year in you table should help in that &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new columns like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1&lt;BR /&gt;Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)&lt;BR /&gt;Week Number = WEEKNUM([Date],2)&lt;BR /&gt;Week = if('Date'[Week Number]&amp;lt;10,'Date'[Year]*10 &amp;amp; 'Date'[Week Number],'Date'[Year]&amp;amp;'Date'[Week Number])&lt;BR /&gt;Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense) &lt;BR /&gt;Week name = [Week Start date] &amp;amp; " to "&amp;amp; [Week End date]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in case you need to compare&lt;/P&gt;
&lt;P&gt;Power BI — Week on Week and WTD &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=pnAesWxYgJ8" target="_blank"&gt;https://www.youtube.com/watch?v=pnAesWxYgJ8&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 15:33:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228110#M53124</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-08T15:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate data for every week in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228384#M53131</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;It might be a bit difficult to calculate if you only have cost and budget data for one day. So, I think the easiest way to solve this is to allocate the budget and costs to day level in powerquery.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The additional steps would be something like this:&lt;BR /&gt;&lt;BR /&gt;#"Added Custom1" = Table.AddColumn(#"Appended Query", "DaysInMonth", each Date.DaysInMonth([Date])),&lt;BR /&gt;#"Added Custom2" = Table.AddColumn(#"Added Custom1", "DateList", each List.Numbers(1,[DaysInMonth])),&lt;BR /&gt;#"Expanded DateList" = Table.ExpandListColumn(#"Added Custom2", "DateList"),&lt;BR /&gt;#"Added Custom3" = Table.AddColumn(#"Expanded DateList", "DailySum", each [Value]/[DaysInMonth]),&lt;BR /&gt;#"Added Custom4" = Table.AddColumn(#"Added Custom3", "Newdate", each #date(Date.Year([pvm]),Date.Month([pvm]),[DateList])as date),&lt;BR /&gt;#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom4",{{"DailySum", type number}, {"Newdate", type date}})&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This way you can allocate the data for each day of the year and from there the calculation works like it does with your Sales data. I hope this helps you to solve your issue and if it does consider accepting this as a solution!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 17:21:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228384#M53131</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-08T17:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate data for every week in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228519#M53139</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;. Thank you for reply. I didn't fully understand the advice about powerquery. Could you please make an example file based on our example that is attached below?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://drive.google.com/file/d/1msJo6d17e5R22WwQ86ZTkLA5rkLVEw_V/view?usp=sharing" target="_self" rel="nofollow noopener noreferrer"&gt;Example file&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 19:24:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228519#M53139</guid>
      <dc:creator>DimaMD</dc:creator>
      <dc:date>2021-12-08T19:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate data for every week in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228815#M53144</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Due to information security reasons I am not able to dowload your example file. However, I made a more complete example on how to make yearly budget into a daily one by using powerquery.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Example Data:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Commented powerquery:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;let&lt;BR /&gt;Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQz1DMyMDJU0lEyNAABpVgdkKgRTBTKN0bjm6DxTdH4Zmh8czS+BRrfEo1vaIAuYIgugOTEWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Budget = _t]),&lt;BR /&gt;#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Budget", Int64.Type}}),&lt;BR /&gt;#"Filled Down" = Table.FillDown(#"Changed Type",{"Budget"}), //Here I fill the yearly budget to every month&lt;BR /&gt;#"Divided Column" = Table.TransformColumns(#"Filled Down", {{"Budget", each _ / 12, type number}}), //Since now it is on a monthly level. I divide the budget with 12&lt;BR /&gt;#"Added Custom1" = Table.AddColumn(#"Divided Column", "DaysInMonth", each Date.DaysInMonth([Date])), //Here I add the amount of days for every month&lt;BR /&gt;#"Added Custom2" = Table.AddColumn(#"Added Custom1", "DateList", each List.Numbers(1,[DaysInMonth])), //Now I make a list of values based on previous step&lt;BR /&gt;#"Expanded DateList" = Table.ExpandListColumn(#"Added Custom2", "DateList"), //Here the list is expanded&lt;BR /&gt;#"Added Custom3" = Table.AddColumn(#"Expanded DateList", "DailySum", each [Budget]/[DaysInMonth]), //Now we transform monthly budget to a daily one&lt;BR /&gt;#"Added Custom4" = Table.AddColumn(#"Added Custom3", "Newdate", each #date(Date.Year([Date]),Date.Month([Date]),[DateList])as date), //Here I add a proper Date column&lt;BR /&gt;#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom4",{{"DailySum", type number}, {"Newdate", type date}}) // Some data type changes&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;in&lt;BR /&gt;#"Changed Type1"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;End result:&lt;BR /&gt;&lt;/STRONG&gt;&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>Wed, 08 Dec 2021 21:56:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2228815#M53144</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-08T21:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate data for every week in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2229973#M53186</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;your knowledge of power query is excellent but,&lt;BR /&gt;It is difficult for me to understand how I should implement this, the problem is that I take data from the OLAP system.&amp;nbsp;&lt;BR /&gt;In addition to the date, I have budget items&lt;BR /&gt;My complete tables contain the following data&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Data.Year&lt;/TD&gt;&lt;TD&gt;Data.Mounth&lt;/TD&gt;&lt;TD&gt;id organization&lt;/TD&gt;&lt;TD&gt;id. unit&lt;/TD&gt;&lt;TD&gt;Article budget&lt;/TD&gt;&lt;TD&gt;Budget&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;01.01.2021&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;321&lt;/TD&gt;&lt;TD&gt;Article 1&lt;/TD&gt;&lt;TD&gt;120000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;01.01.2021&lt;/TD&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;321&lt;/TD&gt;&lt;TD&gt;Article 2&lt;/TD&gt;&lt;TD&gt;100000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I understand that the Request has to convert my table.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 09:49:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2229973#M53186</guid>
      <dc:creator>DimaMD</dc:creator>
      <dc:date>2021-12-09T09:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate data for every week in matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2230089#M53188</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Here is how you can chage that kind of data to daily budget:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Steps:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQz1DMyMDJU0lEyNAABIMOzJDXXUClWB1XWCEnWSCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Budget = _t, Item = _t]),&lt;BR /&gt;#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Budget", Int64.Type}}),&lt;BR /&gt;//Add amount of months&lt;BR /&gt;#"MonthlistS" = Table.AddColumn(#"Changed Type", "Monthlist", each List.Numbers(1,12)), //create list&lt;BR /&gt;#"months2"= Table.ExpandListColumn(#"MonthlistS", "Monthlist"), //Here I fill the yearly budget to every month&lt;BR /&gt;#"Divided Column" = Table.TransformColumns(months2, {{"Budget", each _ / 12, type number}}), //Since now it is on a monthly level. I divide the budget with 12&lt;BR /&gt;#"NewDate1"= Table.AddColumn(#"Divided Column", "Newdate1", each #date(Date.Year([Date]),[Monthlist],1)as date), //Create date from month&lt;BR /&gt;#"Changed Type2" = Table.TransformColumnTypes(NewDate1,{{"Newdate1", type date}}),&lt;BR /&gt;&lt;BR /&gt;#"Added Custom1" = Table.AddColumn(#"Changed Type2", "DaysInMonth", each Date.DaysInMonth([Newdate1])), //Here I add the amount of days for every month&lt;BR /&gt;#"Added Custom2" = Table.AddColumn(#"Added Custom1", "DateList", each List.Numbers(1,[DaysInMonth])), //Now I make a list of values based on previous step&lt;BR /&gt;#"Expanded DateList" = Table.ExpandListColumn(#"Added Custom2", "DateList"), //Here the list is expanded&lt;BR /&gt;#"Added Custom3" = Table.AddColumn(#"Expanded DateList", "DailySum", each [Budget]/[DaysInMonth]), //Now we transform monthly budget to a daily one&lt;BR /&gt;#"Added Custom4" = Table.AddColumn(#"Added Custom3", "Newdate", each #date(Date.Year([Date]),Date.Month([Newdate1]),[DateList])as date), //Here I add a proper Date column&lt;BR /&gt;#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom4",{{"DailySum", type number}, {"Newdate", type date}}),&lt;BR /&gt;#"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Date", "Budget", "Monthlist", "Newdate1", "DaysInMonth", "DateList"}) // Some data type changes and clean up&lt;BR /&gt;in&lt;BR /&gt;#"Removed Columns"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;End result:&lt;/STRONG&gt;&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;</description>
      <pubDate>Thu, 09 Dec 2021 10:45:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-data-for-every-week-in-matrix/m-p/2230089#M53188</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-09T10:45:55Z</dc:date>
    </item>
  </channel>
</rss>

