cancel
Showing results for
Did you mean:
Helper I

## Dax - Filtro de fecha

Hola gente,

Tengo dos medidas para una tabla de fechas, pero para diferentes períodos:

Período contable (mm/21/aaaa a mm+1/20/aaaa)
Otros períodos

Ejemplo:

MonthAccount 8 (06/21/2020 a 07/20/2020)

MonthAccount 9 (07/21/2020 a 08/20/2020)

MonthAccount 10 (08/21/2020 a 09/20/2020)

Me gustaría hacer una medida que identifique el período de fecha que el usuario ha filtrado para elegir la medida adecuada.

Si el usuario: Filtrar fechas dentro del período contable (mm / 21/2020 a mm + 1/20/2020)
- medida 1
Más
- medida 2

En resumen: si el período filtrado solo tiene un valor para MonthAccount, elija la medida 1, si no la medida 2.

¿Es posible hacer eso?

1 ACCEPTED SOLUTION
Community Support

Hola @XTF_2020 ,

Por favor, intente esto:

``````Measure =
VAR CountMonthAccount_ =
CALCULATE (
DISTINCTCOUNT ( 'Table'[MonthAccount] ),
FILTER (
'Table',
'Table'[Date] >= MIN ( 'Date'[Date] )
&& 'Table'[Date] <= MAX ( 'Date'[Date] )
)
)
RETURN
IF ( CountMonthAccount_ = 1, [Measure 1], [Measure 2] )
``````
``````Measure 1 = 1
Measure 2 = 0``````

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Community Support

Hola @XTF_2020 ,

Por favor, intente esto:

``````Measure =
VAR CountMonthAccount_ =
CALCULATE (
DISTINCTCOUNT ( 'Table'[MonthAccount] ),
FILTER (
'Table',
'Table'[Date] >= MIN ( 'Date'[Date] )
&& 'Table'[Date] <= MAX ( 'Date'[Date] )
)
)
RETURN
IF ( CountMonthAccount_ = 1, [Measure 1], [Measure 2] )
``````
``````Measure 1 = 1
Measure 2 = 0``````

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

#### Launching new user group features

Learn how to create your own user groups today!