Skip to main content

Transpose a table?

Comments

3 comments

  • VISUI

    You would have to use the UnCrosstab Filter on the datalayer and then a Crosstab Filter.


    <Report ID="LogiForum.CrosstabUncrosstab">
      <Body>
        <Label Caption="Original Data" Class="h5" />
        <DataTable ID="dt1">
          <DataLayer Type="Static">
            <StaticDataRow Product="A" January="32" February="12" March="11" />
            <StaticDataRow Product="B" January="56" February="55" March="22" />
            <StaticDataRow Product="C" January="87" February="25" March="55" />
            <DataLayerLink ID="dllinked" />
          </DataLayer>
          <DataTableColumn ID="colProduct" Header="Product">
            <Label ID="lblProduct" Caption="@Data.Product~" />
            <DataColumnSort DataColumn="Product" />
          </DataTableColumn>
          <DataTableColumn ID="colJanuary" Header="January">
            <Label ID="lblJanuary" Caption="@Data.January~" />
            <DataColumnSort DataColumn="January" DataType="Number" />
          </DataTableColumn>
          <DataTableColumn ID="colFebruary" Header="February">
            <Label ID="lblFebruary" Caption="@Data.February~" />
            <DataColumnSort DataColumn="February" DataType="Number" />
          </DataTableColumn>
          <DataTableColumn ID="colMarch" Header="March">
            <Label ID="lblMarch" Caption="@Data.March~" />
            <DataColumnSort DataColumn="March" DataType="Number" />
          </DataTableColumn>
        </DataTable>
        <LineBreak LineCount="2" />
        <Label Caption="Data Uncrosstabbed" Class="h5" />
        <DataTable ID="dt2">
          <DataLayer Type="Linked" LinkedDataLayerID="dllinked">
            <UnCrosstabFilter ColumnHeadingID="Name" ValueColumnID="Value" LabelColumns="Product" />
          </DataLayer>
          <AutoColumns />
        </DataTable>
        <LineBreak LineCount="2" />
        <Label Caption="Re-Crosstabbed" Class="h5" />
        <CrosstabTable ID="ct1">
          <DataLayer Type="Linked" LinkedDataLayerID="dllinked">
            <UnCrosstabFilter ColumnHeadingID="Name" ValueColumnID="Value" LabelColumns="Product" />
            <CrosstabFilter CrosstabColumn="Product" CrosstabLabelColumn="Name" CrosstabValueColumn="Value" CrosstabValueFunction="Sum" />
          </DataLayer>
          <CrosstabTableLabelColumn Header="Month">
            <Label Caption="@Data.Name~" />
          </CrosstabTableLabelColumn>
          <CrosstabTableValueColumns ID="ctv" Header="@Data.rdCrosstabColumn~">
            <Label Caption="@Data.rdCrosstabValue~" />
          </CrosstabTableValueColumns>
        </CrosstabTable>
      </Body>
      <ideTestParams />
    </Report>

     

    1
  • VISUI

    You will need to do a bit of finessing in order to get the Months column in the correct calendar order since at this point the values are just string values, but this will get you close to a solution.

    0
  • Beamon

    Thank you!

    0

Please sign in to leave a comment.