Hello Team,
We are using xamPivotGrid with excel as a datasource. We have to create custom measure to calculate percentage on grouping of column named "LEVELINFO"
and "SOURCEINFO". And need to show percentage as last column in grid.
Formula:- (TOTAL_COUNT - EXCEPTION COUNT)/TOTAL_COUNT.
So can you please guide us on the same ?
Please find attached zip file which contains sample POC and excel file
Any updates on above query
Thank you so much for your suggestions.
Currently we trying browse excel sheet (FlatDataSource) and bind data dynamically by converting to Data Table by using DynamicTypeBuilder.Please find attached POC,Excel file and pivot grid screenshot for reference.
We need to achieve below things
1. Calculate sum (Grand Total)/Min/Max:- Do we need to do within excel only? Or any other way to achieve.
2. Not able to remove N/A column or rows. So can you please tell us how to achieve progarmatically
Hi omkar,
For cell styling, the type of datasource used doesn't really matter. Here's a simple example for how you could do some kind of conditional formatting on that cell:
<Style TargetType="ig:PivotRowHeaderCellControl"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Cell.Member.Caption}" Value="Level1"> <Setter Property="Background" Value="Red"/> </DataTrigger> </Style.Triggers></Style>
As for changing the column header text from "CATEGORYINFO" to show "Category" you need to provide metadata to the cube for that field. Please see the following documentation for more information:http://help.infragistics.com/doc/WPF/2016.1/CLR4.0/?page=xamPivotGrid_US_Defining_Hierarchies_And_Providing_Metadata_With_FlatData.html
Scroll down about halfway to get to "Providing Metadata with FlatData".
Thanks for your reply. Actually we have to change color of cell value from row /column of pivot grid based on condition. So how to access row /column value when we are using Excel as datasource.?
Need to change column header text eg. Instead of CategoryInfo need to show Category and column header and cell values are not aligned properly. Please let us know about the same.
Please find attached screenshot for reference.
Are you referring to the cells that are showing the actual measure data or are you referring to the column header cells? And does it need to be conditional? For conditional data cells you can handle the CellControlAttached event and programmatically change the cell control Background property based on the cell data. Conditionally changing the row/column header cells is trickier since CellControlAttached doesn't fire for these. You'll probably need to create a style in order to change those. PivotRowHeaderCellControl is the type for the row header cell elements and PivotColumnHeaderCellControl is the type for column header cell elements.