Qlikview - 来自 excel 的数据

Qlikview - data from excel

我有特定的 table 我每天都填写,我需要根据这个 table 创建条形图。

我的 table 看起来像这样:

C、D、E、F 列在一个月中出现一周,我需要填充来自 SmallPlace、BigPlace、All 和 Date 的数据。 G、H、I、J 列下周显示数据。

我需要在 qlikview 和

中加载这个 excel

我不知道。我可以像这样使用 table 创建图表,还是我需要更改我的 table???

从数据的角度来看,excel 文件中的结构很难处理。如果您可以控制 excel 文件,我建议您将其更改为易于加载的内容(不仅在 QV 中)

下面的脚本将加载数据并将其转换为可用于更轻松地构建图表的内容。您也可以从 here

下载我使用的 qvw

P.S。我使用的是 QV 版本 12.1

// Load only the first record to get the available column names
Metadata:
First 1
Load 
  *
From 
  [C:\Users\Home\Documents\Book1.xlsx] (ooxml, embedded labels, table is Sheet1)
;

// Get the total column names - 1 (will exclude the Day column
let sColumnsCount = NoOfFields('Metadata') - 1;

// How many iterations. 5 is the step 
let sStep = $(sColumnsCount) / 5;

for i = 0 to $(sColumnsCount) - 1 step 5

  // Get the column names for each iteration
  let sDay              = FieldName( 1, 'Metadata' );
  let sLocationField    = FieldName( $(i) + 2, 'Metadata' );
  let sSmallPlaceField  = FieldName( $(i) + 3, 'Metadata' );
  let sBigPlaceField    = FieldName( $(i) + 4, 'Metadata' );
  let sAllField         = FieldName( $(i) + 5, 'Metadata' );
  let sDateField        = FieldName( $(i) + 6, 'Metadata' );

  // Load only the colums from the iteration
  // and append it to the main table
  Data:
  Load
    $(sDay)                as Day,
    $(sLocationField)      as Location,
    $(sSmallPlaceField)    as SmallPlace,
    $(sBigPlaceField)      as BigPlace,
    //$(sAllField)           as All, // <-- Dont think you need this
    $(sDateField)          as Date             
  FROM 
    [C:\Users\Home\Documents\Book1.xlsx] (ooxml, embedded labels, table is Sheet1)
  Where
    lower( $(sLocationField) ) <> 'total' // <-- think that the Total values are not needed as well
  ;

next

Drop Table Metadata;