Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
QFanatic
Creator
Creator

Scripting assistance creating a calculated dimension

hi everyone.

Please find attached.

I have to create a calculated Dimension in my model where I calculate 3 items: (this would be to display in a chart using Calculated Dimension)

1. Value of Debits (would be Sum(val) where Chan = '1SA'). This I would need to calculate for 3 periods - vMaxdate, v1MonthAgo and v2MonthsAgo.

2. Financial Volumes (would be Sum(vol) where Chan = '1SA' and Type = '1'), Also for same 3 periods.

3. Non Financial Volumes (would be Sum(vol) where Chan = '1SA' and Type = '2'), Also for same 3 periods.

 

if I dont go this route, I'd have to do the long way using Valuelist, and I'm a bit lazy...LOL.  I assume, adding these 3 dimensions, would multiply my data volume by 3 - correct?

Please tell me there is an easy way of doing it? All help appreciated.

 

Thanks.

 

Labels (1)
1 Solution

Accepted Solutions
edwin
Specialist III
Specialist III

LOAD
     if(chan='1SA', val) as [Value of Debits],
if(chan='1SA' and Type ='1', vol) as [Fin vol],
if(chan='1SA' and Type ='2', vol) as [non Fin vol],
vol, 
     val, 
     chan, 
     sub_channel, 
     trn_cde, 
     Category, 
     JoinKey, 
     co_cde, 
     period, 
     Old_Category, 
     [CUSTOMER INITIATED], 
     type
FROM 

[$(vQvData)CEO_Report_FinNonFin_Data_$(vReportingDate).qvd] (qvd);

View solution in original post

7 Replies
edwin
Specialist III
Specialist III

not sure I clearly understand what you want to do, did you want to create 3 new fields based on the value of a field?   these become measures not dimensions.

edwin
Specialist III
Specialist III

its not letting me add the expressions

edwin
Specialist III
Specialist III

if(chan='1SA', val) as [Value of Debits],
if(chan='1SA' and Type ='1', vol) as [Fin vol],
if(chan='1SA' and Type ='2', vol) as [non Fin vol],

edwin
Specialist III
Specialist III

in your chart you just sum the measures

QFanatic
Creator
Creator
Author

hi Edwin,

 

thank you for your reply.

I am not understanding...do you add your 'IF" statements in script?

Thanks

edwin
Specialist III
Specialist III

just add the if statements in your load script

edwin
Specialist III
Specialist III

LOAD
     if(chan='1SA', val) as [Value of Debits],
if(chan='1SA' and Type ='1', vol) as [Fin vol],
if(chan='1SA' and Type ='2', vol) as [non Fin vol],
vol, 
     val, 
     chan, 
     sub_channel, 
     trn_cde, 
     Category, 
     JoinKey, 
     co_cde, 
     period, 
     Old_Category, 
     [CUSTOMER INITIATED], 
     type
FROM 

[$(vQvData)CEO_Report_FinNonFin_Data_$(vReportingDate).qvd] (qvd);

View solution in original post