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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
IAA
Helper I
Helper I

Dateadd with filter/if statement?

Dear community,

I have a problem with the following: 

I am creating a cashflow forecast, which is shown in the picture below. The idea is that when the parameter is 2, the date of paying/receving money is shifted two days further in the future.

 

IAA_0-1595596794633.png

I accomplished this with the following formula:

 

 

 

 

CALCULATE ( AVERAGE( 'Value by date 2'[Value] ),
    DATEADD( DimDate[Date], -[Value Parameter], DAY))

 

 

 

 

 

But now I want to combine this with the slicertable, so that when I select "personeelskosten", that only that specific bar shifts two days to the left, while the others stay at the same day (important)

Does anyone have advice how to adjust my formula?

The file can be downloaded here:
https://www.dropbox.com/s/3xs6wyr6tij9vnp/Cashflow%20Forecast.pbix?dl=0

Thank you very much in advance

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

Hi @IAA

 

Create a slicer table as below:

Slicer Table = DISTINCT('Value by date 2'[Category])

Then create a measure as below:

Measure = 
 IF(MAX('Value by date 2'[Category]) in FILTERS('Slicer Table'[Category]),CALCULATE ( AVERAGEX(FILTER(ALL('Value by date 2'),'Value by date 2'[Category]=SELECTEDVALUE('Slicer Table'[Category])), 'Value by date 2'[Value]),DATEADD( DimDate[Date], [Value Parameter], DAY)),CALCULATE(AVERAGE('Value by date 2'[Value]),
    DATEADD( DimDate[Date], [Value Parameter], DAY)))

Finally you will see:

Annotation 2020-07-27 142516.png

For details,pls see attached.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

1 REPLY 1
v-kelly-msft
Community Support
Community Support

Hi @IAA

 

Create a slicer table as below:

Slicer Table = DISTINCT('Value by date 2'[Category])

Then create a measure as below:

Measure = 
 IF(MAX('Value by date 2'[Category]) in FILTERS('Slicer Table'[Category]),CALCULATE ( AVERAGEX(FILTER(ALL('Value by date 2'),'Value by date 2'[Category]=SELECTEDVALUE('Slicer Table'[Category])), 'Value by date 2'[Value]),DATEADD( DimDate[Date], [Value Parameter], DAY)),CALCULATE(AVERAGE('Value by date 2'[Value]),
    DATEADD( DimDate[Date], [Value Parameter], DAY)))

Finally you will see:

Annotation 2020-07-27 142516.png

For details,pls see attached.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

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.