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
mshakir
Regular Visitor

Patrones de tiempo DAX

Tengo que calcular el día no del mes y el día no del trimestre usando dax ayúdame por favor.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@mshakir , Tienes startofmonth y startofquarter

tomar fecha diff de esto obtendrá mes día y trimestre día

STQ - startofquarter(Date[Date])

Día de Qtr á datediff(STQ ,Date[Date],DAY)

View solution in original post

HOLA @mshakir,

Puede crear directamente una nueva columna calculada para utilizar la función 'día' para extraer el día actual no del mes. Para 'día del trimestre', puede consultar la siguiente fórmula de columna calculada:

DayofMonth=DAY('Calendar'[Date])
DayofQuarter =
VAR cQuarter =
    INT ( MONTH ( 'Calendar'[Date] ) / 3 )
        + IF (
            MONTH ( 'Calendar'[Date] ) < 3
                && MOD ( MONTH ( 'Calendar'[Date] ), 3 ) > 0,
            1,
            0
        )
RETURN
    COUNTROWS (
        CALENDAR (
            DATE ( YEAR ( 'Calendar'[Date] ), IF ( cQuarter > 1, ( cQuarter - 1 ) * 3, cQuarter ), 1 ),
            'Calendar'[Date]
        )
    )

saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@mshakir , Tienes startofmonth y startofquarter

tomar fecha diff de esto obtendrá mes día y trimestre día

STQ - startofquarter(Date[Date])

Día de Qtr á datediff(STQ ,Date[Date],DAY)

az38
Community Champion
Community Champion

Hola @mshakir

Quarter No = QUARTER(Table[Date])
Day No = DAY(Table[Date])

https://docs.microsoft.com/en-us/dax/quarter-function-dax

https://docs.microsoft.com/en-us/dax/day-function-dax


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Esta es la tabla de fechas y mi perspectiva es calcular columnas (DayNoOfQuarter y DayNoOfMonth) igual que DayNoOfYear que se indica en la captura de pantalla. necesito número de día para el trimestre y el mes ni el número de trimestre ni el número de mes

DAX.jpg

HOLA @mshakir,

Puede crear directamente una nueva columna calculada para utilizar la función 'día' para extraer el día actual no del mes. Para 'día del trimestre', puede consultar la siguiente fórmula de columna calculada:

DayofMonth=DAY('Calendar'[Date])
DayofQuarter =
VAR cQuarter =
    INT ( MONTH ( 'Calendar'[Date] ) / 3 )
        + IF (
            MONTH ( 'Calendar'[Date] ) < 3
                && MOD ( MONTH ( 'Calendar'[Date] ), 3 ) > 0,
            1,
            0
        )
RETURN
    COUNTROWS (
        CALENDAR (
            DATE ( YEAR ( 'Calendar'[Date] ), IF ( cQuarter > 1, ( cQuarter - 1 ) * 3, cQuarter ), 1 ),
            'Calendar'[Date]
        )
    )

saludos

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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