mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-11 05:43:17 +00:00
Improved
This commit is contained in:
@@ -1,14 +1,24 @@
|
|||||||
function Invoke-Sum {
|
function Invoke-Sum {
|
||||||
param($data,$dimension,$measure)
|
param(
|
||||||
|
$data,
|
||||||
|
$dimension,
|
||||||
|
$measure
|
||||||
|
)
|
||||||
|
|
||||||
|
if(!$measure) {$measure = $dimension}
|
||||||
|
|
||||||
$h=@{}
|
$h=@{}
|
||||||
|
|
||||||
foreach ($item in $data){
|
foreach ($item in $data){
|
||||||
$key=$item.$dimension
|
$key=$item.$dimension
|
||||||
|
|
||||||
if(!$key) {$key="[missing]"}
|
if(!$key) {$key="[missing]"}
|
||||||
|
|
||||||
$h.$key+=$item.$measure
|
$value = $item.$measure
|
||||||
|
if($value -is [string] -or $value -is [System.Enum]) {
|
||||||
|
$value = 1
|
||||||
|
}
|
||||||
|
$h.$key+=$value
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($entry in $h.GetEnumerator()){
|
foreach ($entry in $h.GetEnumerator()){
|
||||||
@@ -17,5 +27,4 @@ function Invoke-Sum {
|
|||||||
$measure=$entry.value
|
$measure=$entry.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user