Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
pover
Luminary Alumni
Luminary Alumni

Is it possible to extract a range of months from BEX Query using variables?

Hello everyone,

I'm having trouble with the extracting one year of data from a BEX Query.  The variable is 0CALMONTH so the range is from 201301 to 201312, but it only returns the garbage seen below.

BEXQuery.jpg

The strange thing is that defining a range works perfectly fine for another BEX Query, but that this one.  Creating slices also doesn't work.  I've ended up creating a for each loop to extract the whole year, but I'm curious what the problem is with doing it the way it should be done.  The load script for the BEX Query is below:

[ZFI_M02/ZFI_M02_Q0044]:

Load *;

Select PseudoMDX (

Dimensions (

  [0BILL_DATE] (),

  [0BILL_NUM] (),

  [0BUS_AREA] (),

  [0COMP_CODE] (),

  [0MATERIAL] (),

  [0NETDUEDATE] (),

  [0SOLD_TO] (),

  [ZDEBITORD] (),

  [ZDEBITORD__0CUSTOMER] (),

  [ZPAY_DATE] (),

  [0CALMONTH] ()),

Measures (

  [00BAUFJVYS4EIU95UVZ67DNHU].[00BAUFJVYS4EIU95UVZ67E6GI], //Cobranza

  [00BAUFJVYS4EIU95UVZ67DNHU].[00BAUFJVYS4EIU95UVZ67E04Y], //Unidades

  [00BAUFJVYS4EIU95UVZ67DNHU].[00BAUFJVYS4EIU95UVZ67FRCI], //UtilidadCobradaCuota

  [00BAUFJVYS4EIU95UVZ67DNHU].[00BAUFJVYS4EIU95UVZ67F8DU], //UtilidadCobradaReal

  [00BAUFJVYS4EIU95UVZ67DNHU].[00BAUFJVYS4EIU95UVZ67FL0Y]), //UtilidadCobradamenor a30 días

// Slices (

//  [0CALMONTH].[201312], [0CALMONTH].[201401]

//  ),

Variables (

  [ZSDVAR21] (I [0CALMONTH].[201301]:[0CALMONTH].[201312])),

From (ZFI_M02/ZFI_M02_Q0044));

Thanks for your help,

Karl

0 Replies