Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Ishaan_Kumar
Contributor III
Contributor III

Only function

only({<MonthYear_F={"$(=date(AddMonths(max(Date),-1),'MMM YYYY'))"},Date=,Date_F=,CalendarYear=,CalendarMonthNum=>}Date_F)

This statement returns Null value . Why so?
If I use Count function instead of Only , it returns correct value i.e no. of days for the month.

Labels (3)
5 Replies
LRuCelver
Partner - Creator III
Partner - Creator III

What are you trying to do?

Only() returns Null if there is more than one distinct value. Otherwise it returns the value.

Ishaan_Kumar
Contributor III
Contributor III
Author

if(Day(only({<MonthYear_F={"$(=date(AddMonths(max(Date),-1),'MMM YYYY'))"},Date=,Date_F=,CalendarYear=,CalendarMonthNum=>}Date_F))<>null(),

rangesum(above(count({<MonthYear_F={"$(=date(AddMonths(max(Date),-1),'MMM YYYY'))"},Date=,Date_F=,Model-={'NA'},CalendarYear=,CalendarMonthNum=,Source-={'Gaadi.com'}>}DISTINCT TC_LeadId),0,rowno()))

,0)

 

This is an expression in Combo chart . It is showing some value in chart in Qlik View where as it is not showing in Qlik Sense.

I am trying to understand the reason behind the same

LRuCelver
Partner - Creator III
Partner - Creator III

While I can't test without the data, here are a few things you might change:

  1. Move all common elements of the set analyses in front of the expression
  2. If you are checking whether the Only returns Null, you don't need to convert it to day

Try this:

 

{<MonthYear_F={"$(=Date(AddMonths(max(Date),-1),'MMM YYYY'))"},Date=,Date_F=,CalendarYear=,CalendarMonthNum=>}
If(
	not IsNull(
		Only(Date_F)
	),
	RangeSum(
		Above(
			Count(
				{<Model-={'NA'},Source-={'Gaadi.com'}>}
				distinct TC_LeadId
			),
			0,
			RowNo()
		)
	)
	,0
)

 

Ishaan_Kumar
Contributor III
Contributor III
Author

Still not working!!

LRuCelver
Partner - Creator III
Partner - Creator III

In that case try testing every sub-expression separately:

  • Get rid of the set expression and set the filters manually.
  • Test just the condition of the if statement with the dimensions of the chart.
  • Test the RangeSum separately and make sure the condition of the if statement is fulfilled when testing.