<?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 Matrix with &amp;quot;Period to Date&amp;quot; rows in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873547#M151305</link>
    <description>&lt;P&gt;Hello Experts:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Looking for some help related to how to structure the Matrix report in the below information.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Report dataset&lt;OL&gt;&lt;LI&gt;is a single dataset with all needed attributes&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;A DATE_DIM table&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;The report parameter is a single date.&lt;/LI&gt;&lt;LI&gt;Report Column has different type of transactions (ORDER, SHIPMENT, INVOICE)&lt;OL&gt;&lt;LI&gt;Report Colume also Split between current vs Last year&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Report Row is by DIVISION/BRAND. Assuming multiple Brands per division.&lt;/LI&gt;&lt;LI&gt;&lt;U&gt;&lt;U&gt;&lt;STRONG&gt;In addition to the Value per selected parameter (Single date), the user also wants to see additional rows for "Week to Date", "Month To Date", "Year To Date"&lt;/STRONG&gt;&lt;/U&gt;&lt;/U&gt;&lt;P&gt;I have #1,2,3,4 completed without issue, but struggling with 5.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I Can use DAX to calculate another measurement for MTD, WTD, QTD, YTD. But it&amp;nbsp; is another measure which can't be added to the row.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I can use a date range (1st of the year to "Parameter Date"), but don't know how to filter this by row per division / Brand.&amp;nbsp;&lt;P&gt;Appreciate any suggestion you may have. Thank you.&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;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Sun, 28 Apr 2024 21:19:41 GMT</pubDate>
    <dc:creator>pengbsam0830</dc:creator>
    <dc:date>2024-04-28T21:19:41Z</dc:date>
    <item>
      <title>Matrix with "Period to Date" rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873547#M151305</link>
      <description>&lt;P&gt;Hello Experts:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Looking for some help related to how to structure the Matrix report in the below information.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Report dataset&lt;OL&gt;&lt;LI&gt;is a single dataset with all needed attributes&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;A DATE_DIM table&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;The report parameter is a single date.&lt;/LI&gt;&lt;LI&gt;Report Column has different type of transactions (ORDER, SHIPMENT, INVOICE)&lt;OL&gt;&lt;LI&gt;Report Colume also Split between current vs Last year&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Report Row is by DIVISION/BRAND. Assuming multiple Brands per division.&lt;/LI&gt;&lt;LI&gt;&lt;U&gt;&lt;U&gt;&lt;STRONG&gt;In addition to the Value per selected parameter (Single date), the user also wants to see additional rows for "Week to Date", "Month To Date", "Year To Date"&lt;/STRONG&gt;&lt;/U&gt;&lt;/U&gt;&lt;P&gt;I have #1,2,3,4 completed without issue, but struggling with 5.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I Can use DAX to calculate another measurement for MTD, WTD, QTD, YTD. But it&amp;nbsp; is another measure which can't be added to the row.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;I can use a date range (1st of the year to "Parameter Date"), but don't know how to filter this by row per division / Brand.&amp;nbsp;&lt;P&gt;Appreciate any suggestion you may have. Thank you.&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;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Sun, 28 Apr 2024 21:19:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873547#M151305</guid>
      <dc:creator>pengbsam0830</dc:creator>
      <dc:date>2024-04-28T21:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with "Period to Date" rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873615#M151308</link>
      <description>&lt;P&gt;Read about "Switch values to rows".&lt;/P&gt;</description>
      <pubDate>Sun, 28 Apr 2024 23:22:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873615#M151308</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-04-28T23:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with "Period to Date" rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873629#M151310</link>
      <description>&lt;P&gt;You could use the following DAX query for the timeframes. Then you could use a column grouping for the transaction type. I've added the column "Year" to the timeframe query for current and last year used as a column grouping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Amount = CALCULATE(SUM('YourTable'[Amount]))+ 0&lt;/LI-CODE&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;LI-CODE lang="markup"&gt;Calendar Timeframe = 
VAR _today_date =                   TODAY()
VAR _yesterday_date =               _today_date - 1
VAR _calendar_year =                YEAR(_today_date)
VAR _fiscal_year =                  YEAR(EDATE( _today_date, 6))
VAR _fiscal_year_start =            DATE( _fiscal_year - 1, 07, 01)
VAR _quarter_start =                DATE ( YEAR (_today_date), ROUNDUP ( DIVIDE ( MONTH (_today_date), 3 ), 0 ) * 3 - 2, 1 )
VAR _month_start =                  DATE( YEAR(_today_date), MONTH(_today_date), 01 )
VAR _week_start =                   _today_date - WEEKDAY ( _today_date, 2 )
VAR _calendar_year_start =          DATE( _calendar_year , 01, 01)

VAR _result = 
    UNION (
      ADDCOLUMNS (CALENDAR ( _today_date, _today_date),             "Timeframe", "DATE",                "Timeframe Order", 1, "Year", "CURRENT YEAR")
    , ADDCOLUMNS (CALENDAR ( _week_start, _today_date ),            "Timeframe", "WEEK TO DATE",        "Timeframe Order", 2, "Year", "CURRENT YEAR")
    , ADDCOLUMNS (CALENDAR ( _month_start, _today_date ),           "Timeframe", "MONTH TO DATE",       "Timeframe Order", 3, "Year", "CURRENT YEAR")
    , ADDCOLUMNS (CALENDAR ( _quarter_start, _today_date ),         "Timeframe", "QUARTER TO DATE",     "Timeframe Order", 4, "Year", "CURRENT YEAR")
    , ADDCOLUMNS (CALENDAR ( _fiscal_year_start, _today_date ),     "Timeframe", "YEAR TO DATE",        "Timeframe Order", 5, "Year", "CURRENT YEAR")
    , ADDCOLUMNS (CALENDAR ( _today_date - 365, _today_date - 365),            "Timeframe", "DATE",                "Timeframe Order", 1, "Year", "LAST YEAR")
    , ADDCOLUMNS (CALENDAR ( _week_start - 365, _today_date - 365),            "Timeframe", "WEEK TO DATE",        "Timeframe Order", 2, "Year", "LAST YEAR")
    , ADDCOLUMNS (CALENDAR ( _month_start - 365, _today_date - 365),           "Timeframe", "MONTH TO DATE",       "Timeframe Order", 3, "Year", "LAST YEAR")
    , ADDCOLUMNS (CALENDAR ( _quarter_start - 365, _today_date - 365),         "Timeframe", "QUARTER TO DATE",     "Timeframe Order", 4, "Year", "LAST YEAR")
    , ADDCOLUMNS (CALENDAR ( _fiscal_year_start - 365, _today_date - 365),     "Timeframe", "YEAR TO DATE",        "Timeframe Order", 5, "Year", "LAST YEAR")
    //, ADDCOLUMNS (CALENDAR ( _fiscal_year_start, _today_date ),     "Timeframe", "FISCAL YEAR TO DATE", "Timeframe Order", 5)  // if you need fiscal year to date
    )

RETURN
_result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You also may want to use another DAX query for the transaction types&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Transaction Types = 
VAR _results = 
    UNION (
      ROW ("Transaction_Type", "ORDER",		"Transaction_Type_Order", 1)
    , ROW ("Transaction_Type", "SHIPMENT",	"Transaction_Type_Order", 2)
    , ROW ("Transaction_Type", "INVOICE",	"Transaction_Type_Order", 3)
    )

RETURN
_results&lt;/LI-CODE&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;</description>
      <pubDate>Mon, 29 Apr 2024 04:54:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873629#M151310</guid>
      <dc:creator>aduguid</dc:creator>
      <dc:date>2024-04-29T04:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix with "Period to Date" rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873700#M151313</link>
      <description>&lt;P&gt;It's a nice option, but it makes all measures to rows? That's not what I am looking for.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 01:11:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-with-quot-Period-to-Date-quot-rows/m-p/3873700#M151313</guid>
      <dc:creator>pengbsam0830</dc:creator>
      <dc:date>2024-04-29T01:11:48Z</dc:date>
    </item>
  </channel>
</rss>

