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: 
Not applicable

IF expression with multiple conditions

Hello everyone,

I need to write a "IF expression" with 4 conditions and I am having troubles.

I have 2 dates: DataMovimento and DataCalendario and thus two calendars.

I would like that: if the user selects a Year/Month/Week/Day of one calendar then the date of the other calendar becomes the same.

The field I need to aggregate is OreDisp (number of hours available)

My try:

if( GetSelectedCount(Date(DataMovimento)) ,  sum( { <DayCalendario = {"=Day(DataMovimento) "}>} OreDisp) ,

                if(GetSelectedCount(Settimana), sum(   {$<SettimanaCalend = {"=Settimana"} >}   OreDisp) ,

          if(GetSelectedCount(Month), sum(   {$<MonthCalendario = {"=Month"}>}   OreDisp) ,

          if(GetSelectedCount(Year), sum(   {$<YearCalendario = {"=Year"}>}   OreDisp) ,0)

)))

It does not seem to work!

Thank you for any reply.

1 Reply
Not applicable
Author

Olá

Não sei se entendi bem o teu problema mas tenta assim (não testei!).

if( GetSelectedCount(Date(DataMovimento)) ,  sum( { <DayCalendario = {"Day(DataMovimento) "}>} OreDisp) ,

                if(GetSelectedCount(Settimana), sum(   {$<SettimanaCalend = {'Settimana'} >}   OreDisp) ,

                    if(GetSelectedCount(Month), sum(   {$<MonthCalendario = {"Month(DataMovimento)"}>}   OreDisp) ,

                         if(GetSelectedCount(Year), sum(   {$<YearCalendario = {"Year(DataMovimento)"}>}   OreDisp) ,0)

)))

Entretanto, se não funcionar mete um sample file

TMF