Group-by and calculate percentage

Ok thanks for clearification

some of many options:

an immediate result like:

grafik

done by:
grafik

(From x In {"MTART", "MATKL" ,"MEINS"}
From d In varDtData.AsEnumerable
Group d By x=x, k1=d(x).toString.Trim Into grp=Group
Let p = (grp.Count/varDtData.Rows.Count*100).toString("F2")
Let ra = New Object(){x,k1, grp.Count, p }
Select r=varDtResult.Rows.Add(ra)).CopyToDataTable

or

Option: Filter Datatable approach:
prepare a filter config with build Datatable - dtFilterParams
grafik

which can populate with col names and its unique values by:

(From x In {"MTART", "MATKL" ,"MEINS"}
Let dv = varDtData.AsEnumerable.Select(Function (d) d(x).toString.Trim).Distinct().ToList
From y In dv
Let ra = New Object(){x,y}
Select dtFilterParams.Rows.add(ra)).CopyToDataTable

grafik

then you can iterate with a for each row over dtFilterParams and can use the the values for filtering and custom implement the report.

feel free to explore activites and components from marketplace as well. e.g

2 Likes