Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cbaqir
Specialist II
Specialist II

Conditional Display on Date

I have a variable that looks at Accuracy % of a forecast by comparing Allocated Hours vs Actual Hours. I only want this variable (and graphs that include it) to show data for current or prior months. Since it's comparing Actual Hours, it does no good to see an outrageously high Accuracy % for future months that don't have any actuals yet.

What is the syntax for the Show Conditional field that I want to use?

Thanks!

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

You can purge the data but its helpful to have some in there (File -> Reduce Data, then do a 'Save As') .

You can  also or alternatively scramble certain fields from the document properties -> Scramble tab

I normally suggest having a variable(s)  that stores the current year and current month . Then use SET ANALYSIS in your expression . Something like this:

num(

          sum(  {$<Year={$(vCurrentYear)}, Month={$(vCurrentMonth)}>} ALLOCATED_EFFORT)

          /

          sum( {$<Year={$(vCurrentYear)}, Month={$(vCurrentMonth)}>} ACTUAL_EFFORT))

, '##.#%';


where Year and Month are the fields that are selections in the dashboard and vCurrentYear and vCurrentMonth are variables whose definition stores the current year and current month


vCurrentYear=   Year(Date(Today()))

vCurrentMonth=  Month(Date(Today()))

View solution in original post

4 Replies
JonnyPoole
Employee
Employee

You can use an IF statement or SET ANALYSIS to focus the expression to certain records in the date model (such as current month or prior month records).

If you have a more detailed sample of what you are doing please share the qvw ?

cbaqir
Specialist II
Specialist II
Author

Jonathan,

My variable is:

vAccuracyPercent = num(sum(ALLOCATED_EFFORT)/sum(ACTUAL_EFFORT)), '##.#%'; 

For an easy example, I have a text box that shows =num($(vAccuracyPercent))

I also have a year and a month selection in the app.

How can I attach a working QVW without the data source?

JonnyPoole
Employee
Employee

You can purge the data but its helpful to have some in there (File -> Reduce Data, then do a 'Save As') .

You can  also or alternatively scramble certain fields from the document properties -> Scramble tab

I normally suggest having a variable(s)  that stores the current year and current month . Then use SET ANALYSIS in your expression . Something like this:

num(

          sum(  {$<Year={$(vCurrentYear)}, Month={$(vCurrentMonth)}>} ALLOCATED_EFFORT)

          /

          sum( {$<Year={$(vCurrentYear)}, Month={$(vCurrentMonth)}>} ACTUAL_EFFORT))

, '##.#%';


where Year and Month are the fields that are selections in the dashboard and vCurrentYear and vCurrentMonth are variables whose definition stores the current year and current month


vCurrentYear=   Year(Date(Today()))

vCurrentMonth=  Month(Date(Today()))

cbaqir
Specialist II
Specialist II
Author

Thank you. I will have to play with it a bit.