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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
NewbieJono
Post Partisan
Post Partisan

if statement within another formula

Could someone help, i wish to add a statement within this dax (Please see bold section) to check Min date if another coloumn labeled 'FACT - ISG'[Counted]) <> "Not Counted"
 
also is anyone able to format this in the correct format for DAX formulas, mine is starting to get messy, i am not sure how best lay things out.
 
Working Days Old =
CALCULATE(
COUNTROWS('DIM - Date Table'),
DATESBETWEEN('DIM - Date Table'[Date], Min('FACT - ISG'[Date of Receipt]), max('FACT - ISG'[Date])),
'DIM - Date Table'[IsWorkingDay] = 1,
'DIM - Date Table'[IsHoliday] = 0,
all ('DIM - Date Table'))
1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

Try:

Working Days Old =
VAR StartDate =
    CALCULATE (
        MIN ( 'FACT - ISG'[Date of Receipt] ),
        'FACT - ISG'[Counted] <> "Not Counted"
    )
VAR EndDate =
    MAX ( 'FACT - ISG'[Date] )
VAR Result =
    CALCULATE (
        COUNTROWS ( 'DIM - Date Table' ),
        DATESBETWEEN ( 'DIM - Date Table'[Date], StartDate, EndDate ),
        'DIM - Date Table'[IsWorkingDay] = 1,
        'DIM - Date Table'[IsHoliday] = 0
    )
RETURN
    Result

 

I've removed all ('DIM - Date Table')). If you mark the table as a date table that is taken care of for you.

 

Formatting wise download DAX Studio and it'll do it for you or use DAX Formatter by SQLBI



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

1 REPLY 1
bcdobbs
Community Champion
Community Champion

Try:

Working Days Old =
VAR StartDate =
    CALCULATE (
        MIN ( 'FACT - ISG'[Date of Receipt] ),
        'FACT - ISG'[Counted] <> "Not Counted"
    )
VAR EndDate =
    MAX ( 'FACT - ISG'[Date] )
VAR Result =
    CALCULATE (
        COUNTROWS ( 'DIM - Date Table' ),
        DATESBETWEEN ( 'DIM - Date Table'[Date], StartDate, EndDate ),
        'DIM - Date Table'[IsWorkingDay] = 1,
        'DIM - Date Table'[IsHoliday] = 0
    )
RETURN
    Result

 

I've removed all ('DIM - Date Table')). If you mark the table as a date table that is taken care of for you.

 

Formatting wise download DAX Studio and it'll do it for you or use DAX Formatter by SQLBI



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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