cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
BerlinAlexander
Helper II
Helper II

DAX: Cuente el número de días de la semana (no fines de semana) TM

Hola

Quiero tener algo similar a "countifs" - Quiero contar los días en el mes actual que no son sábados o domingos.

Trabajo con una base de datos en línea y no puedo crear columnas adicionales.

Mi columna 'Fecha'[Fecha] enumera todas las fechas de forma continua, día a día, incluidos los fines de semana.

Tengo esto, que no funciona:

JustWorkdaysThisMonth - CALCULATE(

COUNTROWS(DATESMTD('Date'[Date])),

FILTER('Date', WEEKDAY('Date'[Date]-"Saturday") SEMANA DE SEMANA('Fecha'[Fecha]-"Domingo"))

)

¿Tienes algún consejo?

4 REPLIES 4
AilleryO
Memorable Member
Memorable Member

Hola

¿Podrías probar algo como esto :

ISWeekDayTM SWITCH (MyCalendar[WeekDayName]; "domingo"; 0; "sábado";0;1)

A continuación, puede hacer una suma en esta columna IsWeekDay.

Espero que esto ayude

amitchandak
Super User
Super User

@BerlinAlexander , Probar como


JustWorkdaysThisMonth - CALCULATE(
COUNTROWS(FILTER('Date', WEEKDAY('Date'[Date],2) <6)),DATESMTD('Date'[Date])
)

O


JustWorkdaysThisMonth - CALCULATE(
COUNTROWS('Date'),DATESMTD('Date'[Date])
FILTER('Date', WEEKDAY('Date'[Date],2) <6)
)

Muchas gracias. Tengo una pregunta adicional.

Parece que esto está considerando todo el mes.

Si quisiera tener MTD en su lugar (es decir, hoy es 15 de julio, así que me gustaría considerar el tiempo desde el mes que comienza hasta el 15 de julio), ¿cómo debo cambiar el código?

Hola

Tiene la función STARTOFMONTH() que debería hacer el truco.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors