Forum Discussion
Convert value from measure to a Constant Value
- 5 years ago
Hi Anonymous ,
Modify your variable as below:
Variable1 = SUMX ( FILTER ( ALL (maintable[position],maintable[intensity]), maintable[position] = 1 && maintable[intensity] = 0 ), maintable[Value] )Best Regards,
KellyDid I answer your question? Mark my post as a solution!
Here is the full Measure:
//This variable needs to be converted to a constant value.
VAR Variable1 = CALCULATE( sumx(maintable, maintable[Value]), Filter(All(maintable[position]), maintable[position] = 1), maintable[intensity]=0 )
RETURN
//The VAR from above is plugged into the measure below. When Variable1 is instead hardcoded with the same fixed/contant value the measure works perfectly. Is there a workaround?
if(or(SUM(maintable[position]) = 0 && sum(maintable[Value]) = Variable1,
(SUM(maintable[intensity]) = 0 && sum(maintable[Value]]) = Variable1)),
Sum(maintable[Value]) +1, Sum(maintable[Value]))
Hey Anonymous ,
in general it's very uncommon to use SUMX within CALCULATE and also that you put some arguments in FILTER and some in the context of CALCULATE.
I would do the FILTER part in the SUMX:
Variable1 =
SUMX(
FILTER(
ALL( maintable[position] ),
maintable[position] = 1 && maintable[intensity] = 0
),
maintable[Value]
)
Can you check if that will result in the same value?
Then when you add the "Variable1" in your main measure, which of the results will be executed?