cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
XTF_2020
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
v-xuding-msft
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
v-xuding-msft
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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.