Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Alex_LYQ
Contributor
Contributor

A strange issue happened when using If(Aggr(Only()))

I'm using below dimension and measure to build a chart

Dimension:

=IF(GetSelectedCount(ObjectUsageType)=1,
Pick(Match(GetFieldSelections(ObjectUsageType), 'Object', 'Field', 'Export'),
ObjectName,
[Selected Field],
ObjectName
),
Aggr(Only({<ObjectUsageType={"Object"}>}ObjectName), ObjectName)
)

 

Measure:

NUM(SUM({<Flag_Session={$(vShowUsage)}>}ObjectUsageCount))

 

related data model:

Alex_LYQ_1-1733461104213.png

 

In this case, I found that when I'm using this dimension and measure, the value of measure looks not correct, and when I click one of the dimension, it will auto select a random value of field [Selected Field]:

Alex_LYQ_2-1733461289411.png

Alex_LYQ_4-1733461587365.png

 

But I didn't filter any value of [Selected Field], it should display all the value of [Selected Field] right?

And then I found that if I changed the Dimension to below:

=Aggr(Only({<ObjectUsageType={"Object"}>}ObjectName), ObjectName)

then it can display correctly

Alex_LYQ_3-1733461460664.png

 

The only difference is whether I add the if condition, but this condition normally takes the second expression. Why does it cause such a difference?

 

0 Replies