Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

link button and expression

I have two buttons ; one monthly and the another yearly

I have two expressions

exp1

= SUM({<DateTest = {">=$(=Date(yearStart(Today())))<=$(=Date(Today()))"}>}[Prix de vente TTC])
+
SUM({<[Date Time] = {"<=$(=Date(MonthEnd(Today())))>$(=Date(Today()))"}>}[CA TTC])

exp2

= SUM({<DateTest = {">=$(=Date(yearStart(Today())))<=$(=Date(Today()))"}>}[Prix de vente TTC])
+
SUM({<[Date Time] = {"<=$(=Date(yearend(Today())))>$(=Date(Today()))"}>}[CA TTC])

How can I link buttons monthly with exp1 and yearly with exp2 ? when I choose monthly i get result from exp1 and when I choose yearly I get result from exp2 ?

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Assign the button actions to set a variable (lets call it vYMSelect). Yearly button sets this variable to 2, Monthly button sets it to 1.

Then use this expression:

= SUM({<DateTest = {">=$(=Date(yearStart(Today())))<=$(=Date(Today()))"}>}[Prix de vente TTC])

+ If(vYMSelect = 1,

  SUM({<[Date Time] = {"<=$(=Date(yearend(Today())))>$(=Date(Today()))"}>}[CA TTC]),

  SUM({<[Date Time] = {"<=$(=Date(MonthEnd(Today())))>$(=Date(Today()))"}>}[CA TTC])

)

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

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Assign the button actions to set a variable (lets call it vYMSelect). Yearly button sets this variable to 2, Monthly button sets it to 1.

Then use this expression:

= SUM({<DateTest = {">=$(=Date(yearStart(Today())))<=$(=Date(Today()))"}>}[Prix de vente TTC])

+ If(vYMSelect = 1,

  SUM({<[Date Time] = {"<=$(=Date(yearend(Today())))>$(=Date(Today()))"}>}[CA TTC]),

  SUM({<[Date Time] = {"<=$(=Date(MonthEnd(Today())))>$(=Date(Today()))"}>}[CA TTC])

)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
rubenmarin

Hi, you can add a variable "vYearlyMonthlySelector", the 'Monthly' button sets its value to 'M', and the yearly button to 'Y'

Then you can use this variable value to configure your expression:

If(vYearlyMonthlySelector='M', [exp1], [exp2])

Or you can use it in conditional expression textbox.

Hope this helps.