Search This Blog

Thursday, July 20, 2017

Qlikview , How to recover lost hidden script



Refer จาก : https://www.youtube.com/watch?v=Gt6vIvjtY74


สมมุต App อยู่ C:\QV\App01.qvw

ให้สร้าง Folder --> C:\QV\App01-prj ขึ้นมา คือให้ล้อตามชื่อ App แต่ต่อท้ายด้วย -prj

เปิด App01.qvw ขึ้นมา แล้วกด Save
เปิด Folder App01-prj จะเจอ Source file ทั้งหมด
หา File DocBinary.dat แล้วลบทิ้ง
จากนั้นเปิด App01.qvw ขึ้นมาใหม่ แล้วทำการสร้าง Hidden Script ใหม่

เคสนี้ควรมี Back up script ของตัว Hidden ไว้ด้วย เพื่อสามารถ Copy มา Paste ได้เลย

Friday, June 30, 2017

Qlikview set analysis , Between two values



=

//SUM({<FactAll.RSTrakingDaySEQ={$(vRS_TrackingDaySEQ)}  >} $(vMeasures01Value))
//SUM({<FactAll.RSTrakingDaySEQ={">=$(vRS_TrackingDaySEQ)<=$(vRS_TrackingDaySEQ)"}  >} $(vMeasures01Value))
SUM({<FactAll.RSTrakingDaySEQ={">=1<=$(vRS_TrackingDaySEQ)"}  >} $(vMeasures01Value))


ข้อห้ามมมม ห้ามมี Space ระหว่าง >= <= เด็ดขาด จะทำให้ผลลัพธ์ผิด
" " Space is cause to error result! Pls eliminate it from {}

Thursday, June 22, 2017

Qlikview Chart property is gone! or missing (Solved)

Some time Qlikview wasn't response.
Example I create a chart and adding/adjust some expression and then I click "OK"
The dialog disappear! But It seem the dialog still there! What happen then.
I can do nothing with that screen.
I try to close the others running program ,switch application but have no luck.
Searching in Google still not found any one who have this problem.

AND THEN I realize that I've not try to use the key board key.
So this problem was solved by Press Ctrl+S to save the file and then End task Qlikview.

For better save your ass is to Press Ctrl + F12 (Save as a new file)
Because I've facing some kind of problem that more seriously ,File damaged after saving.
Size of file decrease to 0 KB .
Good luck buddy!

Friday, June 9, 2017

X axis problem when using Linest_M function



AGGR & LINEST_M function


Thank you to https://community.qlikview.com/thread/115111

SOLVED by using : aggr( rowno(), yearmonth))


The trendline formula uses the index number of the x-axis dimension values, i.e the left most value is 1, the next 2 etc. The linest_m function uses the actual x-axis dimension values. You could try:
linest_m(aggr( sum(....vSold...)/sum(....Quantita...) , yearmonth), aggr( rowno(), yearmonth))

See attached example.


Tuesday, May 30, 2017

How to add qlikview user cal (License)

- Open QV Management console
- Click tab "System"
- Select "Qlikview Server"
- Select sub tab "License"
- Select Client Access License (CALs)
- Select Assigned CALs



Thursday, December 15, 2016

Qlikview , Set analysis greater than ,">="

Syntax

SUM(
{ < Calendar.Date = {">=$(=FLOOR(NUM(NOW()-30)))"} >}

FactAll.Fee)

// Sum of last 30 days ">="



Monday, November 14, 2016

Qlikview , Sum sale of top N customer of each month


Using RANK function to check ranking of summary

Case1: Display rank with customer name for each month
Dimension1 = FactAll.MTH_YEAR
Dimension2 = Rank (Calculated Dim)
Dimension3 = CustomerName (Calculated Dim)

Dim2 :Rank
=Aggr(rank(sum(FactAll.Fee)),FactAll.MTH_YEAR ,Account.CustomerName)

Dim3 :CustomerName
=IF(AGGR(RANK(SUM(FactAll.Fee)),FactAll.MTH_YEAR, Account.CustomerName)<= 100 , Account.CustomerName )

























Case2: Display only summary of top 100 customer fee
Dimension1 = FactAll.MTH_YEAR
Expression = SumFee

Measure Expression :
=SUM(
IF(Aggr(rank(sum(FactAll.Fee)),FactAll.MTH_YEAR ,Account.CustomerName)<=100,
Aggr( sum(FactAll.Fee) ,FactAll.MTH_YEAR ,Account.CustomerName))
)


Qlikview , Sum sale of top N customer of each month


Using RANK function to check ranking of summary

Case1: Display rank with customer name for each month
Dimension1 = FactAll.MTH_YEAR
Dimension2 = Rank (Calculated Dim)
Dimension3 = CustomerName (Calculated Dim)

Dim2 :Rank
=Aggr(rank(sum(FactAll.Fee)),FactAll.MTH_YEAR ,Account.CustomerName)

Dim3 :CustomerName
=IF(AGGR(RANK(SUM(FactAll.Fee)),FactAll.MTH_YEAR, Account.CustomerName)<= 100 , Account.CustomerName )






















About order , Just order by rank 



Case2: Display only summary of top 100 customer fee
Dimension1 = FactAll.MTH_YEAR
Expression = SumFee

Measure Expression :
=SUM(
IF(Aggr(rank(sum(FactAll.Fee)),FactAll.MTH_YEAR ,Account.CustomerName)<=100,
Aggr( sum(FactAll.Fee) ,FactAll.MTH_YEAR ,Account.CustomerName))
)


Saturday, November 12, 2016

Qlikview , Set analysis refer variable name / Filter with expression


='Y'&vMaxYear& ' : Total New Customer : ' &
NUM(SUM({<Dim_Month.Year={$(=vMaxYear) }>}NewCustomerCount) ,'#,##0')




ตัวอย่างการ Sum fee ของเดือนปัจจุบัน
SUM({<Calendar.MonthlyNum ={$(=DATE(NOW(),'YYYYMM'))}>} FactAll.Fee)



https://community.qlik.com/thread/80861

jagan mohan rao appala
Correct Answerby jagan mohan rao appala on Apr 29, 2013 4:43 AM
Hi,

Try this expression

vDateMin = MonthStart(AddMonths(Max(Date), -12))
vDateMax = MonthEnd(AddMonths(Max(Date), -12))

=Sum({<YearDimensionName=, MonthDimensionName=, QuarterDimensionName=,Date = {">=$(=vDateMin)<=$(=vDateMax)"}>}$(vSales))

Exclude the date filters like Year, Month or Quarter selections if there are any.  Also check whether the date formats are same in Variable and Dimension.

Hope this helps you.

Thursday, November 10, 2016

Qlikview , Ignore (Except) all sections but one!


=NUM(
COUNT({$<[$(=Concat({1<$Field-={'Team.TeamName','Customer.CustBrokerageFlag','Customer.CustWealthFlag','Customer.CustBTSFlag','Marketing.MktName','Customer.CustEmployeeFlag'}>} distinct $Field,']=,[')&']=')
,Customer.CustStatus={"Available"} > }  DISTINCT CustomerUID)
,'#,##0')




=COUNT(
{$<[$(=Concat({1<$Field-={'FactAll.YEAR'}>} distinct $Field,']=,[')&']=')
  >}
  DISTINCT Account.MGM_ReferGroupID)


FactAll.YEAR หมายความว่า Selection ที่เกิดกับฟิลด์นี้มีผล ก็คือ Exception ของการนับ

ส่วนตย.ด้านบนที่มี  ,Customer.CustStatus={"Available"} หมายถึงต้องการ Filter อย่างอื่นเพิ่ม

งงมาก Script นี้


มีอีกตัวอย่างที่ง่าย และน่าจะโอเค
https://community.qlik.com/thread/60630

sum({1<FieldToKeep=P(FieldToKeep)>}Fieldname)




************* ตัวอย่างนี้สุดยอด **************
การนับวันทำงานที่เหลือของปี หรือไม่ก็เวลาที่กำหนด

=IF(GetSelectedCount(Calendar.Year)=0 ,
COUNT(  
{$<[$(=Concat({1<$Field-={'Calendar.Year', 'Calendar.Month'}>} distinct $Field,']=,[')&']=') ,Calendar.WorkingDay={"Y"},Calendar.Year={$(=DATE(FLOOR(NOW()-1),'YYYY'))},Calendar.Date={">=$(=FLOOR(NOW()))"}  >} 
DISTINCT    Calendar.Date)
,
COUNT(  
{$<[$(=Concat({1<$Field-={'Calendar.Year', 'Calendar.Month'}>} distinct $Field,']=,[')&']=') ,Calendar.WorkingDay={"Y"} ,Calendar.Date={">=$(=FLOOR(NOW()))"} >} 
DISTINCT    Calendar.Date)


)




*************อันนี้ต่อ String Field เพื่อทำ Except บางอย่าง ************* 
ดูผลลัพธ์ใน Text แล้วคือ Field ทั้งหมดที่มี 
=Concat({1<$Field-={'Calendar.Year'}>} distinct $Field,']=,[')&']=' 


Wednesday, November 9, 2016

Qlikview , Dual (Chart) function , Multiple value on data point

Credit : https://community.qlikview.com/thread/166577

As a requirement , how to display value on data point in difference way.

Example you have bar chart contain sum of sale across month. Let's say you want Y axis to show the exactly of sale summary , But value on bar chart showing % of each month vs total.

Using DUAL : DUAL Function
DUAL(Text ,Number)

Example =
DUAL(
  NUM(SUM(Sales)/SUM( TOTAL Sales) ,'#,##0.00%'),
  SUM(Sales)
)


The another useful technic to formatting the axis
https://community.qlik.com/thread/97554
Summary : Create a dummy expression and then set invisibility and set the number format in number tab as you want. Incredible! Marvellous!

Qlikview , Round() Function , The amazing function from Qlik

As we know we usually us Round() function an particular script.
Our perception was Round is use to round only the decimal digit , But Qlikview is so difference!
Please read the manual.
Qlikview ROUND()

Qlikview , ValueLoop (Chart function)


Refer to :
https://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/ChartFunctions/SyntheticDimensionFunctions/valueloop.htm

The great function for some advance technical.

Qlikview , Auto generate

Load Date($(vMinDate) + recno()) as Date autogenerate vMaxDate - vMinDate

Tuesday, November 8, 2016

Qlikview , Variables

แนะนำให้ใช้ Variable ในการทำงาน ซึ่งจะส่งผลดีในอนาคตเนื่องจากค่าบางอยางเราจะต้องเรียกใช้บ่อยๆ และเมื่อใช้บ่อยๆแล้ว หากมีการเปลี่ยนแปลงสูตรคำนวนก็ต้องตามแก้ไขทุกจุด แต่หากใช้ Variable แทนก็จะลดปัญหานี้ไปได้เยอะ

การสร้าง Variable (Design)
Document properties -->Variables tab -->New

ตัวอย่างที่1 MeasureType
ใน Dashboard บางครั้งต้องการแสดงค่า Fee บางครั้งต้องการแสดง Value (Trade) เราควรมี Option ให้เลือกได้ว่าจะดูด้วย Measure ไหนเราสามารถสร้างตัวแปรมารับและใช้ Object input-box เพื่อสร้าง Listbox ให้เลือกได้

vMeasureType มีค่าเท่ากับ Fee หรือ Value
vMeasureValue จะอ้างถึง Field Name ที่จะนำมาใช้งาน
** แนะนำให้ตั้งชื่อตัวแปรเริ่มต้นด้วย "v"

--- vMeasureValue calc---
IF(vMeasureType ='Fee' ,'Fact.Fee','Fact.Value')

และใน Chart ที่จะเรียกใช้งานว่าจะกระทำโดยใช้ Fee หรือ Value ปกติจะเขียนแบบนี้
SUM( Fact.Fee) หรือ SUM(Fact.Value)
แต่หากใช้ตัวแปรแล้วจะอ้างถึงได้อย่างไร
1 อ้างถึงในเชิงใช้ค่าที่ได้ตรงๆ  = vMeasureValue
2 อ้างถึงเพื่อให้เป็น Dimension = $(vMeasureValue)

เมื่อใช้ใน Sum expression จะเป็น SUM(  $(vMeasureValue) )
โดยถ้า vMeasureType  = Fee จะเป็น Sum(Fact.Fee) Else Sum(Fact.Value)


Qlikview , Set analysis

Syntax ของ Set Analysis คือ {< Set1,Set2,Set3,SetN>}
Set1 Syntax = DimensionName = {""} เช่น 
{<ProductGroup={"Cola","Beer"}>} และถ้าต้องการทำ Set analysis มากกว่า 1 dimension จะเป็น

{<ProductGroup={"Cola","Beer"} ,Region={"North","South"}   >}



ตัวอย่างการใช้งาน
SUM(
{<ProductGroup={"Cola","Beer"} ,Region={"North","South"}   >}
 Sales)
คือ Sum ยอดขายของสินค้า Cola และ Beer ในภาคเหนือและใต้

Qlikview , Aggr function the most powerful data grouping tactic

ตัวอย่างการใช้งาน
=AGGR(Count(DISTINCT
{<FactAll.FactType={"TX"}  >}
Product.ProductGroup ) , CustomerUID)


ตัวอย่างนี้เป็นการทำ Aggregate เพื่อให้ได้จำนวนออกมา โดยการนับ Product ที่ลูกค้า 1 คนซื้อ
เช่น Peter ซื้อ Cola และ Beer  ค่า Aggr จะได้ค่าเป็น 2 ซึ่งก็คือหลักการทำ Basket analysis
เมื่อมีจำนวนลูกค้ามากมายค่า Aggr ที่ได้ออกมาก็อาจจะเป็นตั้งแต่ 1-N ค่า


และต่อมาเมื่อต้องการวิเคราะห์ว่าลูกค้านิยมซื้อสินค้าใดร่วมกัน ก็สามารถใช้ Function Aggr นี้ได้
=Aggr( Concat( DISTINCT {<FactAll.FactType={"TX"}>}  Product.ProductGroup  ,' + ') , CustomerUID)
ผลลัพธ์ที่ได้จะออกมาดังนี้
1 Cola
1 Beer
1 Candy
2 Beer + Candy
2 Beer + Cola
3 Cola + Candy
3 Beer + Candy + Cola


Remarks * : {<FactAll.FactType={"TX"}>}   = Set analysis ที่บอกว่าต้องมีข้อมูล factType = "TX" เท่านั้นถึงจะนำมาคำนวณ

----------- อีกตัวอย่างเรื่องการนับจำนวน ตามเงื่อนไขการ SUMM
Hi,
I'm creating a line chart with month, and count().
count ( distinct Customer_Code)
How can i do the distinct count with IF statement. says count distinct customer if they sales is more than certain amount?
I tried :

if (sum(sales) <> 0 , count ( distinct Customer_Code))
But it's not working. and SET can't do sum() within it. any other alternatives?
Thanks
Trent Jones
Correct Answerby Trent Jones on Apr 20, 2011 12:43 PM
I would go with:

count(distinct aggr(if(sum(Sales)>100000,CustomerId),CustomerId))



Qlikview , How to get current active sheet name

You can not get sheet name ? What we gonna do ??
ตามที่บอกว่าไม่สามารถ Get active sheet "name" ได้ แต่สามารถ Get active sheet ID ได้ โดยใช้ Function =SUBFIELD(GetActiveSheetId(),'\',-1)

และ Qlikview มีข้อห้ามในการ Naming SheetID โดยถ้ามี Space จะทำให้มีปัญหา
ดังนั้นหากตั้ง Sheet Name = "Active Customer" แล้วต้องเป็น "Active_Customer"
หากจะนำ Sheet name มาแสดงให้ใช้ Script ในการตัด Under score "_" ออกไป ตามตัวอย่าง

=REPLACE(SUBFIELD(GetActiveSheetId(),'\',-1),'_',' ')

Qlikview , Alternate state การเปรียบเทียบข้อมูลใน Qlikview

Alternate stage เป็น feature ที่น่าสนใจและสามารถตอบโจทย์การใช้งาน Qlikview เพื่อการเปรียบเทียบ
ตัวอย่างเช่น หากเราต้องการเปรียบเทียบ Sale performance ของทีม Marketing สองทีมโดยใช้การสร้าง Group ในส่วน Alternate stage  และ Refer Group name ในส่วนที่ต้องการ

Setting : Document property --> General tab -->Alternate stage -->Create new
Refer : Example in list box : -->List box properties-->General tab -->Alternate state
Refer in expression : SUM( {Group1} Sales)
   Group1 = Group name we've create in alternate stage