Forum Discussion
saritart1
7 years agoFrequent Visitor
how to create a measure with conditional values
Hello everyone, I am struggling with the creation oaf measure. I hope you can help me. I have a table with some measures that are binary (1,0) as follow: Intensidad alta = if(asisten...
v-yulgu-msft
Microsoft Employee
7 years agoHi saritart1,
Please try this measure:
New Measure =
IF (
SELECTEDVALUE ( table1[Medida] ) = "Baja",
SUMX ( ALLSELECTED ( asistencia ), [intensidad Baja] ),
IF (
SELECTEDVALUE ( table1[Medida] ) = "Media",
SUMX ( ALLSELECTED ( asistencia ), [intensidad Media] ),
SUMX ( ALLSELECTED ( asistencia ), [intensidad Alta] )
)
)
Best regards,
Yuliana Gu
saritart1
7 years agoFrequent Visitor
Thank you very much v-yulgu-msft, it worked!
One last question, if I want to include a contrain (to do it by another column) how should I do it? I did this, but it doesn´t work.
New Measure =
CALCULATE(IF (
SELECTEDVALUE ( table1[Medida] ) = "Baja";
SUMX ( asistencia; asistencia [Intensidad baja] );
IF (
SELECTEDVALUE ( table1[Medida] ) = "Media";
SUMX ( asistencia; asistencia[Intensidad media] );
SUMX ( asistencia ; asistencia[intensidad Alta] )
)
);ALLEXCEPT(asistencia; asistencia[Nombre];asistencia[Clase]))
As you can see in FIGURE 1, there is no value for "Baja" but, when I apply this expression, somehow, there are values for "Bajo "(FIGURE 2). I believe is because I need to filter the SUMX by "NOMBRE" and that is why I tried, but I think I did it on the wrong way.
Thank you very much!
FIGURE 1FIGURE 2
- v-yulgu-msft7 years ago
Microsoft Employee
Hi saritart1,
Please try this:
New Measure = IF ( SELECTEDVALUE ( table1[Medida] ) = "Baja"; SUMX ( ALLEXCEPT ( asistencia; asistencia[Nombre]; asistencia[Clase] ); asistencia[Intensidad baja] ); IF ( SELECTEDVALUE ( table1[Medida] ) = "Media"; SUMX ( ALLEXCEPT ( asistencia; asistencia[Nombre]; asistencia[Clase] ); asistencia[Intensidad media] ); SUMX ( ALLEXCEPT ( asistencia; asistencia[Nombre]; asistencia[Clase] ); asistencia[intensidad Alta] ) ) )Best regards,Yuliana Gu