<?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: Year to date, compare to last year, per category in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2440851#M65334</link>
    <description>&lt;P&gt;Thanks for the reply.&lt;BR /&gt;I´m not sure if I´m explaning this right, the chart looks good, but I dont need the categories as a filter or slicer, I need them to add them as Legend on the chart/visual.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2022 13:37:20 GMT</pubDate>
    <dc:creator>ImPalaBI</dc:creator>
    <dc:date>2022-04-06T13:37:20Z</dc:date>
    <item>
      <title>Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2424461#M64346</link>
      <description>&lt;P&gt;I need to compare cummulative or running total sales of this year, with cummulative or running total sales of last year (this part I think I have solved) but I need to show the categories of sales.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an example of my data:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Category&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2021&lt;/TD&gt;&lt;TD&gt;SalesCampaign1&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/2021&lt;/TD&gt;&lt;TD&gt;SalesCampaign2&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2022&lt;/TD&gt;&lt;TD&gt;SalesCampaign3&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/2022&lt;/TD&gt;&lt;TD&gt;SalesCampaign3&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this formula to calculate this year´s running total sales:&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;This year cummulative sales = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;TOTALYTD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;SUM(venta_final[Sales])&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;And this one to calculate last year´s running total sales:&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;LY cummulative sales = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;venta_final&lt;/SPAN&gt;&lt;SPAN&gt;[This year sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;SAMEPERIODLASTYEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;This is what I get:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;This year cummulative sales&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;LY cummulative sales&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/22&lt;/TD&gt;&lt;TD&gt;400&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I try to add the category to a visual like a table or a chart, it fails. (actually it works with this years sales, but it does not work combined with last year sales.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I expect to get is a table/matrix/chart like this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Category&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;This year cummulative sales&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN&gt;LY cummulative sales&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/22&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;SalesCampaign3&lt;/TD&gt;&lt;TD&gt;150&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/22&lt;/TD&gt;&lt;TD&gt;SalesCampaign1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/22&lt;/TD&gt;&lt;TD&gt;SalesCampaign2&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;(I will also like the line to stop once it reaches the last date with a sale)&lt;BR /&gt;&lt;BR /&gt;Many thanks in advance to anyone willing to help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 14:03:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2424461#M64346</guid>
      <dc:creator>ImPalaBI</dc:creator>
      <dc:date>2022-03-29T14:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2424491#M64348</link>
      <description>&lt;P&gt;Try splitting the category out into a separate dimension table using&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sales Category = DISTINCT( 'Table'[Category])&lt;/LI-CODE&gt;&lt;P&gt;then create a one-to-many relationship from that to your data table and use the new dimension table on your visuals.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 14:13:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2424491#M64348</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-03-29T14:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2424511#M64349</link>
      <description>&lt;P&gt;Thanks for the reply,&lt;/P&gt;&lt;P&gt;I actually have a separate table with the categories and tried to use it on the visuals, with no success, this is my model, I have many categories:&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, 29 Mar 2022 14:20:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2424511#M64349</guid>
      <dc:creator>ImPalaBI</dc:creator>
      <dc:date>2022-03-29T14:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2424546#M64350</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;You are on the right track. Adding a your date table really helps. Please see attached file. I added a record to your sales table,which is not required but wanted to have a many to one relationship with your sales to date tables. I hope this solves the question!&lt;/P&gt;&lt;P&gt;&lt;A title="YTD LY YTD" href="https://drive.google.com/file/d/1gaMc-c5R7JqVIbNGyMGIPo5B51F4XMwz/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1gaMc-c5R7JqVIbNGyMGIPo5B51F4XMwz/view?usp=sharing&lt;/A&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>Tue, 29 Mar 2022 14:28:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2424546#M64350</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-03-29T14:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2425188#M64396</link>
      <description>&lt;P&gt;I still can´t add any category as a legend in the file you sent.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 20:11:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2425188#M64396</guid>
      <dc:creator>ImPalaBI</dc:creator>
      <dc:date>2022-03-29T20:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2425208#M64400</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Your category should generally be in your products dimension table. Can you add a column in Producto, using a function like LOOKUPVALUE or RELATEDTABLE to bring Category over.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Calc Col = LOOKUPVALUE(venta_final'[Category], venta_final[ID], **Producto[ID])&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;**If these are a match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then use Category from your product table and the measures shared earlier should work just fine..&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 20:32:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2425208#M64400</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-03-29T20:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2431724#M64740</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="186843" data-lia-user-login="ImPalaBI" class="lia-mention lia-mention-user"&gt;ImPalaBI&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="179903" data-lia-user-login="Whitewater100" class="lia-mention lia-mention-user"&gt;Whitewater100&lt;/a&gt;&amp;nbsp;'s advice? If your problem has been solved, you can mark the answer as solution to close the thread. If not, please tell me your current problem and feel free to ask me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Janey&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 10:26:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2431724#M64740</guid>
      <dc:creator>v-janeyg-msft</dc:creator>
      <dc:date>2022-04-01T10:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2433320#M64871</link>
      <description>&lt;P&gt;Yes, I have tried the advice, but is not what I´m looking for, I already answered him.&lt;BR /&gt;So far, no solution to my issue.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 16:04:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2433320#M64871</guid>
      <dc:creator>ImPalaBI</dc:creator>
      <dc:date>2022-04-02T16:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2433405#M64878</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Can you please provide an example of your data model, so I can see how your are joining and what fields are being used, in which tables E.g, where are RB-522, S2iF3 XMA5521? Your inital example says sales category but your chart is based on these figures in some part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each item would need a sales cat code in your fact table and a unqiue sales category code would be in a separate table joined to the fact table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More info will help answer your question in this case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 20:40:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2433405#M64878</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-04-02T20:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2433713#M64896</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;I created an example model( dummy data ) that is a good way to obtain the results you want. Please see attached file. The products in the fact table join to the same and unique products in a dimension table, creating a Star Schema. I will paste a picture of the results where the lines stop for both ytd measures based on the most recent data for current year. I hope this solves your question. Thanks..&lt;/P&gt;&lt;P&gt;&lt;A title="Cumulative ytd sales vs last year by category" href="https://drive.google.com/file/d/16SvlMII1FmZIEDS_N2ilBjyt4Imbb_6J/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/16SvlMII1FmZIEDS_N2ilBjyt4Imbb_6J/view?usp=sharing&lt;/A&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2022 12:28:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2433713#M64896</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-04-03T12:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2440851#M65334</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;BR /&gt;I´m not sure if I´m explaning this right, the chart looks good, but I dont need the categories as a filter or slicer, I need them to add them as Legend on the chart/visual.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 13:37:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2440851#M65334</guid>
      <dc:creator>ImPalaBI</dc:creator>
      <dc:date>2022-04-06T13:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2440920#M65339</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;OK, here is an update showing you two ways to present, including the sales cat as legend. I hope this solves the question for you.&lt;/P&gt;&lt;P&gt;&lt;A title="Sales Cat Cumulative Sales to LY" href="https://drive.google.com/file/d/16SvlMII1FmZIEDS_N2ilBjyt4Imbb_6J/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/16SvlMII1FmZIEDS_N2ilBjyt4Imbb_6J/view?usp=sharing&lt;/A&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;</description>
      <pubDate>Wed, 06 Apr 2022 13:55:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/2440920#M65339</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-04-06T13:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Year to date, compare to last year, per category</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/3386876#M127623</link>
      <description>&lt;P&gt;I have facing same issue&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my case i have different categories column and i would like to compare this year date range with last year&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 08:14:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Year-to-date-compare-to-last-year-per-category/m-p/3386876#M127623</guid>
      <dc:creator>eidev12</dc:creator>
      <dc:date>2023-08-18T08:14:27Z</dc:date>
    </item>
  </channel>
</rss>

