Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors