<?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: Tabular Editor - create multiple calculation items in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4151166#M164953</link>
    <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Thanks for the reply from AntrikshSharma&amp;nbsp;, please allow me to provide another insight:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="795498" data-lia-user-login="julpol" class="lia-mention lia-mention-user"&gt;julpol&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Regarding the issue you raised, my solution is as follows:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;1.&lt;/SPAN&gt;&lt;SPAN&gt;I offer two solutions, and you can choose based on your needs: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;One is to use measures:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;% of Total1 = 
VAR denominator=CALCULATE(SUM(Table1[CY Rolling 12M]),ALL('Table1'))
VAR Numerator=SUM('Table1'[CY Rolling 12M])
RETURN Numerator/denominator&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;% of Total 2 = 
VAR denominator=CALCULATE(SUM(Table1[CY Rolling 12M]),ALL('Table1'))

RETURN 'Table1'[CY Rolling 12M]/denominator&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;2.&lt;/SPAN&gt;&lt;SPAN&gt;Here is the final result, which I hope meets your expectations:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Sep 2024 09:18:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-09-15T09:18:48Z</dc:date>
    <item>
      <title>Tabular Editor - create multiple calculation items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4135432#M164264</link>
      <description>&lt;P&gt;Hi Guys, i'm trying to understand if there is way to use the power of calculation items (tabular editor) to achieve the following result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have a table "Table1" with columns : state, date, amount&lt;/P&gt;&lt;P&gt;i have created new measure called Amount Measure in the "Table1" which SUMs the amount&lt;/P&gt;&lt;P&gt;i have created DateTable and linked it with the date field in the "Table1"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to achieve a matrix table having:&lt;/P&gt;&lt;P&gt;- States as rows,&lt;/P&gt;&lt;P&gt;- First two columns would by CY Rolling 12M and PY Rolling 12M (cy for current year and py for previous year).&lt;/P&gt;&lt;P&gt;- Next column would be % of Total (calculated as cy rolling 12m divided by the total of this column)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have managed to create the CY and PY Rolling 12M calc. items as per below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I'm struggling to understand what to do next to create the next % of Total column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&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="csharp"&gt;CY Rolling 12M

VAR CurrentDate = TODAY()  -- Gets the current date
VAR LastDayPreviousMonth = EOMONTH(CurrentDate, -1)  -- Last day of the previous month
VAR Rolling12MStartDate = EDATE(LastDayPreviousMonth, -12)  -- Start date of the rolling 12 months

RETURN
    CALCULATE(
        [Amount Measure],
        DATESBETWEEN(
            'DateTable'[Date],
            EDATE(Rolling12MStartDate, -12)-30,  -- Start date of the rolling 12 months
            Rolling12MStartDate  -- End date of the rolling 12 months
        )
        /*,
        ALL('DateTable'[Year-Month])  -- Ensures that all states are shown
        DATESBETWEEN(
            'DateTable'[Date],
            DATE(2022, 8, 1),  -- Static start date
            DATE(2023, 8, 1)  -- Static end date
        )   
        */
    )



PY Rolling 12M

VAR CurrentDate = TODAY()  -- Gets the current date
VAR Rolling12MStartDate = DATE(YEAR(CurrentDate), MONTH(CurrentDate), 1)  -- First day of the selected month
VAR Rolling12MEndDate = EOMONTH(Rolling12MStartDate, -1)  -- Last day of the month before the selected month

RETURN
    CALCULATE(
        [Amount Measure],  -- Your measure for GWP
        DATESBETWEEN(
            'DateTable'[Date],
            EDATE(Rolling12MStartDate, -12),  -- Start date of the rolling 12 months
            Rolling12MEndDate  -- End date of the rolling 12 months
        ),
        ALL('DateTable'[Year-Month])  -- Ensures that all states are shown
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 12:31:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4135432#M164264</guid>
      <dc:creator>julpol</dc:creator>
      <dc:date>2024-09-05T12:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Tabular Editor - create multiple calculation items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4135505#M164268</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="795498" data-lia-user-login="julpol" class="lia-mention lia-mention-user"&gt;julpol&lt;/a&gt;&amp;nbsp;% of total based on [Amount Measure] or [PY Rolling 12M]/[CY Rolling 12M] ?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 13:05:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4135505#M164268</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2024-09-05T13:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: Tabular Editor - create multiple calculation items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4136154#M164303</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the formula is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;% of Total = [CY Rolling 12M] / Total of [CY Rolling 12M]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&amp;nbsp;[CY Rolling 12M] is calc item an currently the last column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2024 20:19:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4136154#M164303</guid>
      <dc:creator>julpol</dc:creator>
      <dc:date>2024-09-05T20:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Tabular Editor - create multiple calculation items</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4151166#M164953</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Thanks for the reply from AntrikshSharma&amp;nbsp;, please allow me to provide another insight:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="795498" data-lia-user-login="julpol" class="lia-mention lia-mention-user"&gt;julpol&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Regarding the issue you raised, my solution is as follows:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;1.&lt;/SPAN&gt;&lt;SPAN&gt;I offer two solutions, and you can choose based on your needs: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;One is to use measures:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;% of Total1 = 
VAR denominator=CALCULATE(SUM(Table1[CY Rolling 12M]),ALL('Table1'))
VAR Numerator=SUM('Table1'[CY Rolling 12M])
RETURN Numerator/denominator&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;% of Total 2 = 
VAR denominator=CALCULATE(SUM(Table1[CY Rolling 12M]),ALL('Table1'))

RETURN 'Table1'[CY Rolling 12M]/denominator&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&lt;SPAN&gt;2.&lt;/SPAN&gt;&lt;SPAN&gt;Here is the final result, which I hope meets your expectations:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Please find the attached pbix relevant to the case.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;If this post &lt;SPAN&gt;helps&lt;/SPAN&gt;, then please consider Accept it &lt;SPAN&gt;as the solution &lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Sep 2024 09:18:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tabular-Editor-create-multiple-calculation-items/m-p/4151166#M164953</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-15T09:18:48Z</dc:date>
    </item>
  </channel>
</rss>

