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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
LuisCaston82
New Member

Switch and add a result

Dear all,

I've this formula:

Actual YTD + Forecast =

var _YTD = CALCULATE([Amount], BIFRF000[Report] = "", BIFRF000[Period Type] = "T", BIFRF000[Type] = "V")
var _Forecast = CALCULATE([Amount], BIFRF000[Report Type] = "T")

RETURN
 
SWITCH(
    TRUE,
    _YTD = "", _YTD,
    _YTD <> "", _Forecast)

The goal is like this:
LuisCaston82_0-1703677671328.png

November and december is blank so is applying forecast, is correct.
Junuaty to October is real but is summing Actual + Forecast and is not correct, must be only real because _YTD has result.

Do you know how can I do it?




1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@LuisCaston82 

Please try this measure:

Actual YTD + Forecast =
VAR _YTD =
    CALCULATE (
        [Amount],
        BIFRF000[Report] = "",
        BIFRF000[Period Type] = "T",
        BIFRF000[Type] = "V"
    )
VAR _Forecast =
    CALCULATE ( [Amount], BIFRF000[Report Type] = "T" )
RETURN
    IF ( _YTD = 0, _Forecast, _YTD )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
LuisCaston82
New Member

Awersome @Fowmy !!
Thank you so much! Works perfectly.

One doubt more @Fowmy : Do you know why the total doesn´t sum the real?

LuisCaston82_0-1703688073735.png

 

Total sum is: 60.350.227 not 51.951.034.

Fowmy
Super User
Super User

@LuisCaston82 

Please try this measure:

Actual YTD + Forecast =
VAR _YTD =
    CALCULATE (
        [Amount],
        BIFRF000[Report] = "",
        BIFRF000[Period Type] = "T",
        BIFRF000[Type] = "V"
    )
VAR _Forecast =
    CALCULATE ( [Amount], BIFRF000[Report Type] = "T" )
RETURN
    IF ( _YTD = 0, _Forecast, _YTD )
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors