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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Ankhi
Creator
Creator

Condiitional Measure Expression

Hi ,

Can any one please help me with the below requirement??

I have a report where I need to show archive data and current data for forecast data. But for Actual data it is just the current only.

My data model has a field called Archive_Status=Current/Archive. Actual data is always Current. Forecast one set is current and the other set is Archive. All in same table.

In the report, I have added a list box Archive_Status. There is also a list box called MonthYr  (YYYY-MMM). There are other list boxes as well. So that the MonthYr  selection does not impact the other list boxes the MonthYr  is in a different state(StateA)

Now my requirement is when I select Current, from Archive_Status list box

the measure called TRC should show sum of all the available data(total sum). 

But if I select archive from the list box the same measure (TRC) should show only data for the selected date in the MonthYr  column.

The current measure I have is something like below for TRC.  

TRC

=Sum({<
[Cost Status]={'TRC'},
Master.MonthYr =,
Master.Date =,
[Expenditure Type]=
>}[Amount])

ACT:( I need to show data <= selected date in the MonthYr list box)

=Sum({<
[Cost Status]={'ACT'},
Master.MonthYr =,
[Archive Status]=,
Master.Date = {"<=$(=max({StateA}Master.Date))"},
[Expenditure Type]={'*'}-{'$(=GetFieldSelections([Expenditure Type]))'}
>}Amount)

 

Can you please help me to write the TRC measure based on the archive status and date.?

Thanks in advance

Regards

Ankhi

Labels (1)
1 Reply
edwin
Master II
Master II

you can surely create a variable for the expression that changes based on the selected field.  however, it may be difficult to maintain.

if this is a chart, i suggest you create two expressions set the condition for each expression with your two criteria:

=only(archive_status)='Archive'
or
=if(getselectedcount(archive_status)=0 or only(archive_status)='Current' ,1,0)  and maybe add a default Current