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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Imex197
Helper I
Helper I

Recursive Calculation current Month different

Hello,

 

I need your help.

I want to calculate YTD "Won" Volume + expected Volume for next months until 12/20. But the current month should include Won Volume and the expected Volume.

 

 

My Dax Code for this measure is:

WonYTD and Expected CY = IF (
NOT ( ISBLANK ( [Estimated Opportunity Value ACD won] ) );
[Estimated Opportunity Value ACD won];
CALCULATE (
[Expected Prob Value ECD])
)

 

As visual I use the Waterfall:WaterFall.png

 

Thanks in advance.

Cheers

Imex197

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Imex197 

 

I have tried to make the below solution which I believe works just fine. I assume you have a calendar table which you should also use on the axis.

 

Measure = 
IF(
    -- VALUES(Calendar[Date]) returns all seletected days in a given context
    TODAY() in VALUES( 'Calendar'[Date]);
    SUM( 'Fact'[Expected]) + SUM( 'Fact'[Won]); -- current month
    IF(
        -- If today is larger than the largest date in the filter context then we are looking at previous months thus use [Won] else [Expected]
        TODAY() > MAXX( VALUES( 'Calendar'[Date]); [Date]); 
        SUM( 'Fact'[Won]);
        SUM( 'Fact'[Expected])
    )
)

 

If this works then please mark it as the accepted solution. Kudos is also appreciated.

 

BR

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

Not Sure I got it completely. Can you share sample data and sample output?

You can use time intelligence for YTD with date calendar

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi amitchandak,

 

thanks for your fast reply. I Can´t share any data.

let me try again:Table_Waterfall.png

Mariusz
Community Champion
Community Champion

Hi @Imex197 

 

Try something like below

 

Measure = 
VAR __dates = DATESYTD( 'Calendar'[Date] )
VAR __endOfMonth =  
CALCULATE(
    MAX( 'Calendar'[Date] ),
    FORMAT( 'Calendar'[Date], "YYYYMM" ) = FORMAT( TODAY(), "YYYYMM" )
)
VAR __before = CALCULATE(
    SUM( 'Table'[Value] ),
    FILTER( __dates, 'Calendar'[Date] <= __endOfMonth )
)
VAR __after = CALCULATE(
    SUM( 'Table'[Value] ),
    FILTER( __dates, 'Calendar'[Date] > __endOfMonth )
)
RETURN 
__before + __after

 

 

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn


 

Hi @Mariusz 

 

thanks for your help.

I changed the Format to "YYYYMMDD" now it suits better 🙂

But I wanted to have isolated values.

Is there a chance to have these value isolated per month and not cumulative?

 

Cheers

Imex197

 

Anonymous
Not applicable

Hi @Imex197 

 

I have tried to make the below solution which I believe works just fine. I assume you have a calendar table which you should also use on the axis.

 

Measure = 
IF(
    -- VALUES(Calendar[Date]) returns all seletected days in a given context
    TODAY() in VALUES( 'Calendar'[Date]);
    SUM( 'Fact'[Expected]) + SUM( 'Fact'[Won]); -- current month
    IF(
        -- If today is larger than the largest date in the filter context then we are looking at previous months thus use [Won] else [Expected]
        TODAY() > MAXX( VALUES( 'Calendar'[Date]); [Date]); 
        SUM( 'Fact'[Won]);
        SUM( 'Fact'[Expected])
    )
)

 

If this works then please mark it as the accepted solution. Kudos is also appreciated.

 

BR

Hi @Anonymous ,

 

this is perfect! Thank you!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.