Forum Discussion
variable instead of measure in calculate function
Hellou, can somebody help me with measure like this?
Calculate([measure], filter(table, value = 1))+calculate([measure], filter(table, value = 2))+calculate([measure], filter(table, value = 3))
I created a measure like this, but it's very slow. I think it's because I used the same measure four times.
And I know this won´t work:
var measure1 = [measure]
return
Calculate(measure1 , filter(table, value = 1))+calculate(measure1 , filter(table, value = 2))+calculate(measure1 , filter(table, value = 3))
Is there any way how to optimize the measure please? How to use variable?
Thank you
Hey Fiala , depending on your visual requiremtns it's one of these two:
(Also change the characters to your region: "," to ";" and "." to ","_Measure = CALCULATE ( [measure], FILTER ( ALL ( table[column], table[column1], table[column2] ), table[column] = "Call" && ( table[column1] = BLANK () || table[column1] = "Newbie" ) && table[column2] = BLANK () ) ) + CALCULATE ( [measure], FILTER ( ALL ( table[column], table[column1], table[column2] ), table[column] = "Call" && table[column1] IN { "1/2DOV", "1/2lek", "1/2" } && table[column2] = BLANK () ) ) * 0.5
or_Measure = CALCULATE ( [measure], KEEPFILTERS ( FILTER ( ALL ( table[column], table[column1], table[column2] ), table[column] = "Call" && ( table[column1] = BLANK () || table[column1] = "Newbie" ) && table[column2] = BLANK () ) ) ) + CALCULATE ( [measure], KEEPFILTERS ( FILTER ( ALL ( table[column], table[column1], table[column2] ), table[column] = "Call" && table[column1] IN { "1/2DOV", "1/2lek", "1/2" } && table[column2] = BLANK () ) ) ) * 0.5
In case it solved your question, please mark this as a solution. Appreciate your Kudos.
6 Replies
- Fiala
Helper II
hi SpartaBI, thank you..
My measure is actually more complicated..
=
CALCULATE (
[measure];
FILTER (
table;
table[column] = "Call"
&& table[column1] = BLANK ()
&& table[column2] = BLANK ()
)
)
+ CALCULATE (
[measure];
FILTER (
table;
table[column] = "Call"
&& table[column1] = "1/2DOV"
&& table[column2] = BLANK ()
)
) * 0,5
+ CALCULATE (
[measure];
FILTER (
table;
table[column] = "Call"
&& table[column1] = "1/2lek"
&& table[column2] = BLANK ()
)
) * 0,5
+ CALCULATE (
[measure];
FILTER (
table;
table[column] = "Call"
&& table[column1] = "1/2"
&& table[column2] = BLANK ()
)
) * 0,5
+ CALCULATE (
[measure];
FILTER (
table;
table[column] = "Call"
&& table[column1] = "Newbie"
&& table[column2] = BLANK ()
)
)