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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Need Dynamic Forecast Measure

URGENT DAX Question:

How do I modify this dax: Forecast = CALCULATE(SUM('Q3 Forecast'[Forecast]))
such that selected value if dimTime[Fiscal Quarter]=Q2, then CALCULATE(SUM('Q2 Forecast'[Forecast]),

otherwise if selected value of dimTime[Fiscal Quarter] = Q3 or Q4, then CALCULATE(SUM('Q3 Forecast'[Forecast])).

Thanks so much!

1 ACCEPTED SOLUTION
DataZoe
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

 

If it's only Q2 that has a different forecast, you might be able to try this simple solution:

 

SWITCH(
SELECTEDVALUE('dimTime'[Fiscal Quarter]),
"Q2", SUM('Q2 Forecast'[Forecast]),
SUM('Q3 Forecast'[Forecast])
)

 It could be an IF too, but I left it at SWITCH in case you wanted to check for BLANK() and have it return BLANK() if no quarter is selected.

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

8 REPLIES 8
DataZoe
Microsoft Employee
Microsoft Employee

Hi @Anonymous ,

 

If it's only Q2 that has a different forecast, you might be able to try this simple solution:

 

SWITCH(
SELECTEDVALUE('dimTime'[Fiscal Quarter]),
"Q2", SUM('Q2 Forecast'[Forecast]),
SUM('Q3 Forecast'[Forecast])
)

 It could be an IF too, but I left it at SWITCH in case you wanted to check for BLANK() and have it return BLANK() if no quarter is selected.

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Anonymous
Not applicable

Thanks @DataZoe That worked!

aj1973
Community Champion
Community Champion

Hi @Anonymous 

Try this

Forecast =
VAR _FiscalQurter = SELECTEDVALUE(dimTime[Fiscal Quarter])

VAR _F1 = CALCULATE(SUM('Q1 Forecast'[Forecast]))

VAR _F2 = CALCULATE(SUM('Q2 Forecast'[Forecast]))

VAR _F3_F4 = CALCULATE(SUM('Q3 Forecast'[Forecast]))

VAR Result = IF(_FiscalQurter = Q1, _F1 ,
                                    IF(_FiscalQurter = Q2,

                                                                       _F3_F4
                         ) )
RETURN

Result

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Thanks Amine. Can you pls take a look at the screenshot.

I need it so if Fiscal Quarter = Q2, then _F2, but if Fiscal Quarter = Q3 or Fiscal Quarter = Q4, then _F3_F4.

The 1st condition is clear to me (Q2).

But how can I modify the 2nd condition so that if Fiscal Quarter = Q3 or Q4, then _F3_F4.

If I want to use a SWITCH statement, how would that look like?
Thanks!

dax.png

aj1973
Community Champion
Community Champion

How about Q1, Return = Blank()? if so then

 

VAR Result = IF(_FiscalQurter = Q2, _F2 ,
                                    IF(OR(_FiscalQurter = Q3, _FiscalQurter = Q4)

                                                                       _F3_F4,

                                                                                Blank()
                         ) )

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Thanks again Amine. I don't need Q1 because there is not forecast for Q1 (Q1 is only budget so pulls from different table). So I modified the formula and there is new error 😞

dax.png

aj1973
Community Champion
Community Champion

aj1973_0-1705111432362.png

 

check out which one!

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Anonymous
Not applicable

Do you mean delete each ")" by trial and error until the error is resolved?

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