cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Dax - Filtro de fecha

Hola gente,

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

Capture.JPG


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

Accepted Solutions
Highlighted
Community Support
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

v-xuding-msft_0-1601364853097.png

v-xuding-msft_1-1601364876532.png

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.

View solution in original post

1 REPLY 1
Highlighted
Community Support
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

v-xuding-msft_0-1601364853097.png

v-xuding-msft_1-1601364876532.png

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.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors