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!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
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
Solved! Go to Solution.
@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,
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,
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 )
)
)
)
)
Thanks, this works really well.
@Anonymous Although the empty value now shows up as blank instead of £0?
@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
)
How strange! Thanks Nick.
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 41 | |
| 39 | |
| 22 | |
| 21 |
| User | Count |
|---|---|
| 144 | |
| 106 | |
| 63 | |
| 38 | |
| 31 |