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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
evez
New Member

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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