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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Date Range

Hi,

 

I have a formula but I am looking at changing it do the date range is specifically between two dates?

 

2017 YTD  = (IF (CALCULATE (SUM('Data Dump - Spend'[Credit (incl VAT)])) = BLANK(),0,

CALCULATE (SUM('Data Dump - Spend'[Credit (incl VAT)]),FILTER (ALL('Data Dump - Trade Spend'[Invoice Date] ),'Data Dump - Spend'[Invoice Date] <= DATE ( 2017, 6, 1 )))))

 

How could I change it to be between 01.04.2017 and 01.06.2017?

 

Kind regards

 

Dom

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@Anonymous,

You can use this:

2017 YTD =
 (
    IF (
        CALCULATE ( SUM ( 'Data Dump - Spend'[Credit (incl VAT)] ) ) = BLANK (),
        0,
        CALCULATE (
            SUM ( 'Data Dump - Spend'[Credit (incl VAT)] ),
            FILTER (
                ALL ( 'Data Dump - Trade Spend'[Invoice Date] ),
                'Data Dump - Spend'[Invoice Date] <= DATE ( 2017, 6, 1 )
                    && 'Data Dump - Spend'[Invoice Date] >= DATE ( 2017, 4, 1 )
            )
        )
    )
)

View solution in original post

Anonymous
Not applicable

@Anonymous,

Try this instead: 

2017 YTD =
IF (
    CALCULATE ( SUM ( 'Data Dump - Spend'[Credit (incl VAT)] ) ) = BLANK (),
    0,
    CALCULATE (
        SUM ( 'Data Dump - Spend'[Credit (incl VAT)] ),
        FILTER (
            ALL ( 'Data Dump - Trade Spend'[Invoice Date] ),
            'Data Dump - Spend'[Invoice Date] <= DATE ( 2017, 6, 1 )
                && 'Data Dump - Spend'[Invoice Date] >= DATE ( 2017, 4, 1 )
        )
    )
        + 0
)

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@Anonymous,

You can use this:

2017 YTD =
 (
    IF (
        CALCULATE ( SUM ( 'Data Dump - Spend'[Credit (incl VAT)] ) ) = BLANK (),
        0,
        CALCULATE (
            SUM ( 'Data Dump - Spend'[Credit (incl VAT)] ),
            FILTER (
                ALL ( 'Data Dump - Trade Spend'[Invoice Date] ),
                'Data Dump - Spend'[Invoice Date] <= DATE ( 2017, 6, 1 )
                    && 'Data Dump - Spend'[Invoice Date] >= DATE ( 2017, 4, 1 )
            )
        )
    )
)
Anonymous
Not applicable

Thanks, this works really well.

Anonymous
Not applicable

@Anonymous Although the empty value now shows up as blank instead of £0?

Anonymous
Not applicable

@Anonymous,

Try this instead: 

2017 YTD =
IF (
    CALCULATE ( SUM ( 'Data Dump - Spend'[Credit (incl VAT)] ) ) = BLANK (),
    0,
    CALCULATE (
        SUM ( 'Data Dump - Spend'[Credit (incl VAT)] ),
        FILTER (
            ALL ( 'Data Dump - Trade Spend'[Invoice Date] ),
            'Data Dump - Spend'[Invoice Date] <= DATE ( 2017, 6, 1 )
                && 'Data Dump - Spend'[Invoice Date] >= DATE ( 2017, 4, 1 )
        )
    )
        + 0
)
Anonymous
Not applicable

How strange! Thanks Nick.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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