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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
memasarif
New Member

Agregue filas si es el último día del mes y si está en días de la semana

Queridos todos,

Me gustaría sumar las filas para val si son el último día del mes y si están en los días de la semana. Si el último día del mes corresponde a sábado o domingo, sumar el viernes. ¿Cuál podría ser la fórmula? Necesito una fórmula general para agregar. Tengo varios meses en mi mesa.

Sí, gracias. lastday.png

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hola @memasarif ,

Por favor, consulte la siguiente medida:

Measure =
VAR a =
    ADDCOLUMNS (
        SUMMARIZE (
            'Table',
            'Table'[Date],
            'Table'[Val],
            "weekday", WEEKDAY ( 'Table'[Date], 2 ),
            "weeknum", WEEKNUM ( 'Table'[Date] ),
            "eomonth", EOMONTH ( 'Table'[Date], 0 )
        ),
        "lastworkday",
            IF (
                'Table'[Date] = [eomonth],
                IF ( [weekday] <= 5, 1, 0 ),
                IF ( [weekday] = 5 && [weeknum] = WEEKNUM ( [eomonth] ), 1, 0 )
            )
    )
RETURN
    SUMX ( FILTER ( a, [lastworkday] = 1 ), 'Table'[Val] )

Para obtener más información, consulte el archivo pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/ER3TmlaekNFKjActYx...

Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Saludos

Dedmon Dai

View solution in original post

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hola @memasarif ,

Por favor, consulte la siguiente medida:

Measure =
VAR a =
    ADDCOLUMNS (
        SUMMARIZE (
            'Table',
            'Table'[Date],
            'Table'[Val],
            "weekday", WEEKDAY ( 'Table'[Date], 2 ),
            "weeknum", WEEKNUM ( 'Table'[Date] ),
            "eomonth", EOMONTH ( 'Table'[Date], 0 )
        ),
        "lastworkday",
            IF (
                'Table'[Date] = [eomonth],
                IF ( [weekday] <= 5, 1, 0 ),
                IF ( [weekday] = 5 && [weeknum] = WEEKNUM ( [eomonth] ), 1, 0 )
            )
    )
RETURN
    SUMX ( FILTER ( a, [lastworkday] = 1 ), 'Table'[Val] )

Para obtener más información, consulte el archivo pbix: https://qiuyunus-my.sharepoint.com/:u:/g/personal/pbipro_qiuyunus_onmicrosoft_com/ER3TmlaekNFKjActYx...

Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Saludos

Dedmon Dai

Greg_Deckler
Super User
Super User

@memasarif - Pensar algo como:

Measure =
  VAR __Date = MAX([DATE])
  VAR __Table = 'Table'
  VAR __Table1
    ADDCOLUMNS(
      __Table,
      "FinalVal",
        SWITCH([DAY NAME]),
          "SUNDAY",SUMX(FILTER(__Table,[DATE]=__Date-2),[VAL]),
          "SATURDAY",SUMX(FILTER(__Table,[DATE]=__Date-1),[VAL]),
          [VAL]
        )
     )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
sreenub
Resolver II
Resolver II

Por favor, encuentre a continuación Mesure para encontrar el saldo del último día laborable.
El último día de trabajo BalanceAmount ?
CALCULAR (
SUM ( Hecho[BalanceAmount] ),
FILTER ( DimDate, DimDate[Fecha] á MAX ( DimDate[Fecha] ) && DimDate[Weekdaynumber]<6)
)

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors