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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
jbolivar
Frequent Visitor

Error counting weekends

Hi guys.

I have 2 tables. One is the DimDate table where I have the Non-working days column, Saturdays and Sundays (0 Weekly, 1 Non-working). The other GTI Table where there are 2 columns with 2 dates: Creation date and expiration date. Both tables are linked.

 

In the GTI table, I'm calculating how many Saturdays and Sundays there are between Creation date and expiration date:

 

FDS = CALCULATE (SUM (DimDate [DiaLaboral]); FILTER (DimDate; DimDate [Date]> = FIRSTDATE (GTI_POWERBI [Creation Date]) && DimDate [Date] <LASTDATE (GTI_POWERBI [End Date]))).

 

This works very well for me but when the Due Date is a Monday, the previous weekend does not count it (Case 1 in Red) but I have another date if it does (Case 2 in blue).

 

In the image, the result of case 1 must be 10 and not 8. But case 2 is correct and both end on a Monday.

Can you help me?

 

DiasFDS.JPG

 

Case 1: It´s wrong

10FDS.JPG

 

Case 2: Its Ok

08FDS.JPG

I appreciate your help.  Sorry for my English

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@jbolivar

 

Hi, you can use a calculated column with:

 

FDS =
CALCULATE (
    SUM ( DimDate[DiaLaboral] ),
    FILTER (
        DimDate,
        DimDate[Date] >= GTI_POWERBI[Fecha de Creación]
            && DimDate[Date] < GTI_POWERBI[Fecha de Vencimiento]
    )
)

Regards

 

Victor

Lima - Peru




Lima - Peru

View solution in original post

2 REPLIES 2
Vvelarde
Community Champion
Community Champion

@jbolivar

 

Hi, you can use a calculated column with:

 

FDS =
CALCULATE (
    SUM ( DimDate[DiaLaboral] ),
    FILTER (
        DimDate,
        DimDate[Date] >= GTI_POWERBI[Fecha de Creación]
            && DimDate[Date] < GTI_POWERBI[Fecha de Vencimiento]
    )
)

Regards

 

Victor

Lima - Peru




Lima - Peru

Excelente Vvelarde.

 

Muchas gracias. Funcionó perfecto

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.