Forum Discussion
sunnypb
3 years agoFrequent Visitor
DOUBT CALCULATION DAX % TIME
Hola amigos, agradecería infinitamente su ayuda. Tengo el siguiente problema y no encuentro el cálculo. Tengo la siguiente tabla y necesito saber el % del tiempo que una casa está entre 17 y 24 (tem...
- 3 years ago
Hi sunnypb ,
Please try:
Percentage = VAR _a = ADDCOLUMNS ( 'Table', "Comfort", IF ( ( 'Table'[TIPO SONDA] = "TEMPERATURA" && [LECTURA] <= 25 && [LECTURA] >= 17 ) || ( 'Table'[TIPO SONDA] = "HUMEDAD" && [LECTURA] <= 60 && [LECTURA] >= 40 ), "Comfortable", "Uncomfortable" ) ) RETURN DIVIDE ( COUNTROWS ( FILTER ( _a, [Comfort] = "Comfortable" ) ), COUNTROWS ( 'Table' ) )Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jianboli-msft
Community Support
3 years agoHi sunnypb ,
Please try:
Percentage =
VAR _a =
ADDCOLUMNS (
'Table',
"Comfort",
IF (
( 'Table'[TIPO SONDA] = "TEMPERATURA"
&& [LECTURA] <= 25
&& [LECTURA] >= 17 )
|| ( 'Table'[TIPO SONDA] = "HUMEDAD"
&& [LECTURA] <= 60
&& [LECTURA] >= 40 ),
"Comfortable",
"Uncomfortable"
)
)
RETURN
DIVIDE (
COUNTROWS ( FILTER ( _a, [Comfort] = "Comfortable" ) ),
COUNTROWS ( 'Table' )
)
Output:
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.