Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a variable with the following expression:
=sum({< Date = {">=$(=date(Addyears(today(),-1)))<=$(=date(today()-1))"} >}TrnQty)
This formula works fine when I add this to a measure but if I add this to a variable and use the variable as the measure, the sum is adding the entire dataset, not the row only.
How do I correct this?
Thanks
Hi Ken,
The reason is the equal sign "=" in the beginning of the formula. Variables that contain formulas, beginning with an equal sign, are calculated after every change in the data set (selections, changes in other variables, etc...)
The same formula stored in a variable without the beginning equal sign, will produce accurate results when used in a Measure, being enclosed in a $-sign expansion, like this:
$(myFormula)
Best,
Hi Ken,
The reason is the equal sign "=" in the beginning of the formula. Variables that contain formulas, beginning with an equal sign, are calculated after every change in the data set (selections, changes in other variables, etc...)
The same formula stored in a variable without the beginning equal sign, will produce accurate results when used in a Measure, being enclosed in a $-sign expansion, like this:
$(myFormula)
Best,
Hi Oleg,
Thank you for the reply, very helpful.
I have now run into a new problem as part of this same sheet. I have a variable vQty_0% with the following expression:
if(vUsage_1 < [Qty On Hand], vUsage_1, [Qty On Hand])
This formula is giving me the else outcome even through the true condition is being met. vUsage_1 = 51 & [Qty on hand] = 2171. I have checked the format of Qty on hand and this is a numerical field so should be able to compare against each other.
Any ideas on how to resolve?
Thanks
Ken
I figured this one out. I needed to add the $ sign and brackets around the variable.
if($(vUsage_1) < [Qty On Hand], $(vUsage_1), [Qty On Hand])