Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis with embeded functions

Hey Guys,
I'm new to Qlik Sense and have a question regarding Set Analysis using some embedded function.

I use  some embedded functions to get the latest Calendar Year, from my Filter Pane as so:

SubField(GetFieldSelections([Calendar_Year_Nbr],',',GetSelectedCount([Calendar_Year_Nbr])),',',GetSelectedCount([Calendar_Year_Nbr]))

When I embed this formula in a table it returns the correct result (Single Year of: 2016) based on my selection criteria.

As in the screenshot below:

table_Selection.JPG

However when I embed the formula as part of a Set Analysis in a KPI it still returns results from multiple years (2015,2016)
Here is my Set Analysis formula:
count( distinct {$< Calendar_Year_Nbr = {"=$(= SubField(GetFieldSelections([Calendar_Year_Nbr],',',GetSelectedCount([Calendar_Year_Nbr])),',',GetSelectedCount([Calendar_Year_Nbr])))"}>} Dim_Case_DEX_Key)


Here is the a screenshot of the KPIs with the calculated KPI from above. (highlighted in yellow):KPI results.JPG
As you can see it still contains the aggregated result of 2015,2016 rather then just 2016.

Its should give the same result as the KPI  "Hardcoded 2016" on the left 1.49M
Any help would be much appreciated.

Regards Anto

7 Replies
sunny_talwar

May be it is still a text field. Try this:

Count(DISTINCT {$< Calendar_Year_Nbr = {"=$(=Num#(SubField(GetFieldSelections([Calendar_Year_Nbr], ',', GetSelectedCount([Calendar_Year_Nbr])), ',', GetSelectedCount([Calendar_Year_Nbr]))))"}>} Dim_Case_DEX_Key)

Not applicable
Author

Hey Sunny,

Thanks for this but it didn't seem to make a difference still gives me the aggregated results, if more than one year is selected.

Regards Anto

sunny_talwar

Would it be possible for you to share a sample to see the issue?

Not applicable
Author

You won't have access to my Enterprise data source and file is saved

on Qlik Sense Enterprise server.

Do you want me to replicate this solution on Qlik desktop,

with just some dummy data ?

Regards Anto

jonathandienst
Partner - Champion III
Partner - Champion III

What's wrong with using Max(Calendar_Year_Nbr) to get a single year value?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hey Jonathan,
Tried that also gives me an aggregated result , also don't think it takes

into account the dynamic values I've selected

sunny_talwar

Dummy data sample would be enough if what jontydkpi‌ has provided doesn't work for you.

Best,

Sunny