Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Pulkit_Thukral
Partner - Creator II
Partner - Creator II

Using date present as Headers(Columns)

Hi All,

I have a requirement where the data is in the below format:

Node12-Nov13-Nov14-Nov15-Nov16-Nov
1success: 1success: 1success: 1failed: 1failed: 1
2success: 1success: 1success: 1failed: 1failed: 1
3success: 1success: 1success: 1failed: 1failed: 1
4success: 2success: 2success: 2failed: 1failed: 1
5success: 2success: 2success: 2failed: 1failed: 1
6success: 1success: 1success: 1failed: 1failed: 1
7success: 1success: 1success: 1success: 1success: 1
8success: 2success: 2success: 2success: 2success: 2
9success: 3success: 3success: 3success: 3success: 3
10success: 3success: 3success: 3success: 3success: 3

As you may notice DATE is present as Column Header.

Now requirement is to pick out only last 2 dates i.e. 15th Nov and 16th Nov from above data and then check its content :

if last 2 dates have '*Failed*' as the value ,then that node will be considered as a faulty and a report would be generated for such nodes.

From above data,following should be the output in qlikview:

 

Node15-Nov16-Nov
1failed: 1failed: 1
2failed: 1failed: 1
3failed: 1failed: 1
4failed: 1failed: 1
5failed: 1failed: 1
6failed: 1failed: 1

How can this be done in qlikview ?

6 Replies
tresesco
MVP
MVP

May be like in attached.

tracysmart
Creator II
Creator II

You can use Set Analysis in your expression to limit to the last 2 dates and only where it is failed. So it will be something like this

maxstring({<Date={'>=$(=max(Date)-1)'},Data={'failed: 1'} >}Data)

Pulkit_Thukral
Partner - Creator II
Partner - Creator II
Author

Hi Tresesco,

How are you taking "Date" Field in the data ?

tresesco
MVP
MVP

In crosstable() third parameter is number of fields qualifies . And the default is 1. That means here your first field is being picked silently. Learn about crosstable().

Pulkit_Thukral
Partner - Creator II
Partner - Creator II
Author

Hi Tracy,

Date Range would have to be the Primary Measure for calculation.

Example:- Another report- last 5 days Failure report would have only those Nodes listed where last 5 days data is present as Failed .Even is the ratio is 4:1 where last 4 days are Failure and last 5th day is a success, then also that node will be excluded from the list.

Not sure if this is covered in your expression ?

MarcoWedel

Hi,

maybe one solution could be also:

QlikCommunity_Thread_240229_Pic1.JPG

QlikCommunity_Thread_240229_Pic2.JPG

If(Max({$<Date={"=Date>=Max(Total Date)-1"}>} NodeState like '*failed*'), 'faulty', 'ok')

tabTemp:

CrossTable (DateTemp, NodeState)

LOAD * FROM [https://community.qlik.com/thread/240229] (html, codepage is 1252, embedded labels, table is @1) Where Node;

Join

LOAD Distinct

    DateTemp,

    Date(Date#(DateTemp&Year(Today()),'DD-MMMYYYY')) as Date

Resident tabTemp;

hope this helps

regards

Marco