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

Dynamic periodes and crosstable

Hello Everyone,

I have below data set 

//--Creating crosstable to get the Periode values in single column--//
CrossTable(PERIOD_AUX, FLAG, 30)
TableAux:
LOAD
"SOURCEID",
"ENTITY",
"BUKRS",
"BUTXT",
"LANDX",
"REGION",
"DIVISION",
"BLART",
"BELNR",
"AUGDT",
"AUGBL",
"KUNNR",
"BLDAT",
"CPUDT",
"LIFNR",
"NAME1",
"KTOKK",
"TXT30",
"NBOFDAYS",
"BUZEI",
"SGTXT",
"HKONT",
"TXT50",
"BUDAT",
"TOTAL",
"WAERS",
"TOTAL_L",
"HWAER",
"AMOUNT_EUR",
"CATEGORY",
"PERIOD_1",
"PERIOD_2",
"PERIOD_3",
"PERIOD_4",
"PERIOD_5",
"PERIOD_6",
"PERIOD_7",
"PERIOD_8",
"PERIOD_9",
"PERIOD_10",
"PERIOD_11",
"PERIOD_12",
"PERIOD_13"
FROM [...]
(qvd) ;  //-attached the excel file for reference

====================================================================

The values for the periodes are dynamic at backend , eg if periode_1 is Jan2021, when we the March month comes, the 

value for "PERIOD_1" will become Feb 2021

Aspiring_Developer_0-1614255293015.png

The value inside all the "Periode" fields is either 0 or 1. Hence i created a crosstable for the same.

 

Requirement :-

1) to calculate the sum(AMOUNT_EUR) when Flag is 1

2) to get the period values as dynamic 

I tried below --//created a new table to get dynamic monthnames

NoConcatenate

Final_Data:   //created new table 
Load
"SOURCEID",
monthname(addmonths(today(), -num#(subfield(PERIOD_AUX, '_', 2)))) as PERIOD,
AMOUNT_EUR as AMOUNT
Resident TableAux
Where FLAG=1;

By using above table, i got the name of the month:-

Aspiring_Developer_0-1614256307260.png

 

=====================================

Expected output:-

Aspiring_Developer_3-1614255912935.png

 

 

My ouptput:-

Aspiring_Developer_2-1614255774553.png

When i create a new table, the values for Amount increases , the data gets increased.

I am not able to figure out why and how we can achieve this to get the right output. Please help

 

Thank You

 

 

 

1 Reply
Aspiring_Developer
Creator III
Creator III
Author

Hello again,


Can anyone please help me with the above problem ??????/