Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Fetch XML Chart Issue - link-entity

$
0
0

Hi,

I have been scratching my head over this for a while now!

I want to show a chart which shows the number of cases created this year and last year next to each other in a bar chart. I found a great article from Chart Guy: https://crmchartguy.com/2015/06/21/compare-this-year-to-last-year-with-a-dynamics-crm-chart/ 

However, there is an issue seemingly in the link-entity section. I have set filters on each of the linked entities so in reality they should be showing different data but they are showing the exact same data. One should be showing last year data and the other showing this year. 

Can anyone spot why it is showing that they are the same and not each referring to the year which their filters specify? See code below

Thanks

<fetchcollection>
        <fetch mapping="logical" aggregate="true" distinct="true">
          <entity name="incident">
			
            <attribute groupby="true" alias="createdondate" name="createdon" dategrouping="month" />
			
			<link-entity name="incident" from="incidentid" to="incidentid" link-type="outer" distinct="true">
				<attribute alias="LastYear" name="createdon" aggregate="count" distinct="true" />
				<filter type="and">
					<condition attribute="createdon" operator="last-year" distinct="true" />
					<condition attribute="createdon" operator="olderthan-x-years" value="1" distinct="true" />
				</filter>
			</link-entity>
			
			<link-entity name="incident" from="incidentid" to="incidentid" link-type="outer" distinct="true">
				<attribute alias="ThisYear" name="createdon" aggregate="count" distinct="true" />
				<filter type="and">
					<condition attribute="createdon" operator="this-year" distinct="true" />
				</filter>
			</link-entity>
          </entity>
        </fetch>
      </fetchcollection>
      <categorycollection>
        <category alias="createdondate">
          <measurecollection>
            <measure alias="ThisYear" />
          </measurecollection>
          <measurecollection>
            <measure alias="LastYear" />
          </measurecollection>
        </category>
      </categorycollection>
    </datadefinition>
  </datadescription>
  <presentationdescription>
    <Chart Palette="None" PaletteCustomColors="91,151,213; 237,125,49; 160,116,166; 255,192,0; 68,114,196; 112,173,71; 37,94,145; 158,72,14; 117,55,125; 153,115,0; 38,68,120; 67,104,43; 124,175,221; 241,151,90; 186,144,192; 255,205,51; 105,142,208; 140,193,104; 50,125,194; 210,96,18; 150,83,159; 204,154,0; 51,90,161; 90,138,57;">
      <Series>
        <Series LegendText="This Year YTD" ChartType="Column" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40" />
        <Series LegendText="Last Year YTD" ChartType="Column" IsValueShownAsLabel="True" Font="{0}, 9.5px" LabelForeColor="59, 59, 59" CustomProperties="PointWidth=0.75, MaxPixelPointWidth=40" YAxisType="Secondary" />
      </Series>



Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images