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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
srana
Frequent Visitor

How to calculate difference between two columns and applying a filter

Hi all,

I have 3 columns i.e

 

1st column "Dates" that consists of dates from 1st April 2022 till 23rd March 2023.

 

2nd column that has only one date that keeps updating for now it is 18th May 2022.

 

3rd column is present that has list of working day that is marked " Yes" and "No" respective to the dates in "Dates" column.

 

I want to calculate how many days of working is completed from 1st April till 18th May 2022 excluding holidays.

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

Hi, @srana 

If your report contains other slicers to filter the data, try measure formula like:

Completed Working Days = 
CALCULATE (
    COUNT ( 'Table'[1st column] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[1st column] <= MAX ( 'Table'[2nd column] )
            && 'Table'[3rd column] = "Yes"
    )
)

Best Regards,
Community Support Team _ Eason

View solution in original post

5 REPLIES 5
v-easonf-msft
Community Support
Community Support

Hi, @srana 

If your report contains other slicers to filter the data, try measure formula like:

Completed Working Days = 
CALCULATE (
    COUNT ( 'Table'[1st column] ),
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[1st column] <= MAX ( 'Table'[2nd column] )
            && 'Table'[3rd column] = "Yes"
    )
)

Best Regards,
Community Support Team _ Eason

tamerj1
Super User
Super User

Hi @srana 
Please try

 

Completed Working Days =
VAR RefDate =
    MAX ( TableName[Ref. Date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( TableName[Date] ),
        TableName[Working Day] = "Yes",
        TableName[Date] <= RefDate
    )

 

ddpl
Solution Sage
Solution Sage

@srana Can you show sample of your data set...?

ddpl
Solution Sage
Solution Sage

Create a Measure, which gives you count of working days upto 18th May, 2022

 

Days of Working =
     CALCULATE(
          COUNTROWS('Table'),
          'Table'[3rd Column]="Yes",
          'Table'[Dates]<='Table'[2nd Column]
)
 
Hope it will work for you.
srana
Frequent Visitor

It is giving error saying " The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors