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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.