Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
danilopvh
Contributor II
Contributor II

How to calculate field only with the selection of one or more other dimensions

How to calculate a field only with the selection of one or more other dimensions, but always present the total in the KPI when there is no selection.
Just calculate the set referring to one or another dimension, never calculating repeated values.
Examplo. if i select AM value and SR/PF/AM value they cannot duplicate the result and vice versa too

danilopvh_0-1666365966923.png

always present the total in the KPI when there is no selection

danilopvh_1-1666366012463.png

 

I was trying with the 

Sum({<[UF da Lotação]={$(=GetFieldSelections([UF da Lotação]))}>+<[Sigla da Gestora]={$(=GetFieldSelections([Sigla da Gestora]))}>}[#Servidor])

 

but it wasn't working

Thanks

Labels (5)
1 Reply
RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @danilopvh 

I think your problem is that GetFieldSelections will only works when you have one selection because  will return something like

GetFieldSelections ([First name])
Returns 'John'

and for two selections

GetFieldSelections ([First name])
Return  'John,Peter'

and you set analysis need an specify single quotes for each value in order to evaluate

[UF da Lotação]={'John','Peter'}

https://help.qlik.com/es-ES/qlikview/May2022/Subsystems/Client/Content/QV_QlikView/ChartFunctions/Fi...

I thinking you could try possible values here

Sum({<[UF da Lotação]=P([UF da Lotação])>+<[Sigla da Gestora]=P([Sigla da Gestora]) >}[#Servidor])

Although I really don't understand why you don't just do
Sum(
[#Servidor])

hope this helps.

Best,

Help users find answers! Don't forget to mark a solution that worked for you & to smash the like button! 🙂