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
evez
Regular Visitor

Measure to check quarters and display different set of value

I would like to create a measure "forecast" by checking the quarter selected and display different set of values. 

The result for each quarter is correct as shown in table below. however the total is blank. how do i go about get the total of Quarter 1 to 4. 

thanks.

 

Forecast =
SWITCH(
    true(),
SELECTEDVALUE(all_rates_v[fiscal_quarter])=1,[Actual],
SELECTEDVALUE(all_rates_v[fiscal_quarter])=2,[Actual],
SELECTEDVALUE(all_rates_v[fiscal_quarter])=3,[forecast],
SELECTEDVALUE(all_rates_v[fiscal_quarter])=4,[budget]
)
 
result
Quarter1234Total
 ForecastForecastForecastForecastForecast
 200100150400 
1 ACCEPTED SOLUTION
v-sdhruv
Community Support
Community Support

Hi @evez ,

You can try this-

Forecast =
IF(
    HASONEVALUE(all_rates_v[fiscal_quarter]),
    SWITCH(
        TRUE(),
        VALUES(all_rates_v[fiscal_quarter]) = 1, [Actual],
        VALUES(all_rates_v[fiscal_quarter]) = 2, [Actual],
        VALUES(all_rates_v[fiscal_quarter]) = 3, [forecast],
        VALUES(all_rates_v[fiscal_quarter]) = 4, [budget]
    ),
    [Actual] + [Actual] + [forecast] + [budget]
)

 Here HASONEVALUE checks if only one quarter is selected.

Hope this helps!

View solution in original post

4 REPLIES 4
v-sdhruv
Community Support
Community Support

Hi @evez ,

You can try this-

Forecast =
IF(
    HASONEVALUE(all_rates_v[fiscal_quarter]),
    SWITCH(
        TRUE(),
        VALUES(all_rates_v[fiscal_quarter]) = 1, [Actual],
        VALUES(all_rates_v[fiscal_quarter]) = 2, [Actual],
        VALUES(all_rates_v[fiscal_quarter]) = 3, [forecast],
        VALUES(all_rates_v[fiscal_quarter]) = 4, [budget]
    ),
    [Actual] + [Actual] + [forecast] + [budget]
)

 Here HASONEVALUE checks if only one quarter is selected.

Hope this helps!

@v-sdhruv  thanks it works. but i change the code a bit to fit my need. 

 

Forecast =
VAR SelectedQtrs = CONCATENATEX(VALUES(all_rates_v[fiscal_quarter]),all_rates_v[fiscal_quarter],"")
RETURN
if(HASONEVALUE(all_rates_v[fiscal_quarter]),
SWITCH(
    true(),
SELECTEDVALUE(all_rates_v[fiscal_quarter])=1,[Actual],
SELECTEDVALUE(all_rates_v[fiscal_quarter])=2,[Actual],
SELECTEDVALUE(all_rates_v[fiscal_quarter])=3,[ForecastCQ],
SELECTEDVALUE(all_rates_v[fiscal_quarter])=4,[Budget]
),
if(find(1,SelectedQtrs,,0)>0,calculate([Actual],all_rates_v[fiscal_quarter]=1),"")+
if(find(2,SelectedQtrs,,0)>0,calculate([Actual],all_rates_v[fiscal_quarter]=2),"")+
if(find(3,SelectedQtrs,,0)>0,calculate([ForecastCQ],all_rates_v[fiscal_quarter]=3),"")+
if(find(4,SelectedQtrs,,0)>0,calculate([Budget],all_rates_v[fiscal_quarter]=4),"")
)
FBergamaschi
Solution Sage
Solution Sage

Forecast =
SUMX ( 
         VALUES ( all_rates_v[fiscal_quarter] ),
         IF ( 
                  all_rates_v[fiscal_quarter] = 1, 
[Actual],
                  IF (
                          all
_rates_v[fiscal_quarter])=2,[Actual],
                          IF (                      
                                    all_rates_v[fiscal_quarter]=3,[forecast],
                            IF ( 
                                     
all_rates_v[fiscal_quarter])=4,[budget]
                                )
                            )
                      )
           )
)
 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

 

@FBergamaschi  thanks for your reply. but it seems not working. now the quarterly number is incorrect too. while the total is still blank. any other way to work around? 

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.