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

Valores que pertenecen al mes más reciente o pasado del trimestre

Hola. Necesito ayuda para crear una columna (Qtr_Inspections) que tenga valores que pertenezcan al mes más reciente o pasado del trimestre. Básicamente, sólo quiero el último valor de cada trimestre en esta nueva columna.

Esto es lo que tengo:

FechaInspeccionesCuarto
1/1/20200Qtr 1
2/1/20202Qtr 1
3/1/20204Qtr 1
4/1/202010Qtr 2
5/1/20203Qtr 2
6/1/20207Qtr 2
7/1/202011Qtr 3
8/1/20202Qtr 3

Esto es lo que necesito:

FechaInspeccionesCuartoQtr_Inspections
1/1/20200Qtr 14
2/1/20202Qtr 14
3/1/20204Qtr 14
4/1/202010Qtr 27
5/1/20203Qtr 27
6/1/20207Qtr 27
7/1/202011Qtr 32
8/1/20202Qtr 32
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hola @mayerkath ,

Puede crear una medida o una columna calculada como se indica a continuación:

Measure =
VAR _maxdate =
    CALCULATE (
        MAX ( 'Inspections'[Date] ),
        ALLEXCEPT ( 'Inspections', 'Inspections'[Quarter] )
    )
RETURN
    CALCULATE (
        MAX ( 'Inspections'[Inspections] ),
        FILTER (
            ALLSELECTED ( 'Inspections' ),
            'Inspections'[Quarter] = MAX ( 'Inspections'[Quarter] )
                && 'Inspections'[Date] = _maxdate
        )
    )

Columna calculada:

Qtr_Inspections = 
VAR _maxdate =
    CALCULATE (
        MAX ( 'Inspections'[Date] ),
        ALLEXCEPT ( 'Inspections', 'Inspections'[Quarter] )
    )
RETURN
    CALCULATE (
        MAX ( 'Inspections'[Inspections] ),
        FILTER (
            'Inspections',
            'Inspections'[Quarter] = EARLIER ( 'Inspections'[Quarter] )
                && 'Inspections'[Date] = _maxdate
        )
    )

Saludos

Rena

Community Support Team _ Rena
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

4 REPLIES 4
v-yiruan-msft
Community Support
Community Support

Hola @mayerkath ,

Puede crear una medida o una columna calculada como se indica a continuación:

Measure =
VAR _maxdate =
    CALCULATE (
        MAX ( 'Inspections'[Date] ),
        ALLEXCEPT ( 'Inspections', 'Inspections'[Quarter] )
    )
RETURN
    CALCULATE (
        MAX ( 'Inspections'[Inspections] ),
        FILTER (
            ALLSELECTED ( 'Inspections' ),
            'Inspections'[Quarter] = MAX ( 'Inspections'[Quarter] )
                && 'Inspections'[Date] = _maxdate
        )
    )

Columna calculada:

Qtr_Inspections = 
VAR _maxdate =
    CALCULATE (
        MAX ( 'Inspections'[Date] ),
        ALLEXCEPT ( 'Inspections', 'Inspections'[Quarter] )
    )
RETURN
    CALCULATE (
        MAX ( 'Inspections'[Inspections] ),
        FILTER (
            'Inspections',
            'Inspections'[Quarter] = EARLIER ( 'Inspections'[Quarter] )
                && 'Inspections'[Date] = _maxdate
        )
    )

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@mayerkath , Probar como

calculate( Sum(Table[Inspections]), filter( Table,Table[Date] á max(Table[Date])), allexcept(Table, Table[Quarter]))

O

calculate( Sum(Table[Inspections]), filter( Table,format(Table[Date],"YYYYMM") á format(max( Table[Date]),"YYYYMM")), allexcept(Table, Table[Quarter]))

Anonymous
Not applicable

Gracias @amitchandak. Desafortunadamente, esto no me da lo que quiero. ¿Alguna otra idea?

@mayerkath , Por favor, encuentre el archivo adjunto después de la firma

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.