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 September 15. Request your voucher.

Reply
JeroenHD
Helper I
Helper I

Dynamically pass values to FILTER in measure based on selected value

Hello Experts!

 

I have a measure which sums values based on selected value of slicers, namely Year and Period. My question is about dynamically changing values in the FILTER part.
That depends on the selected period in the clicer.


FCST012 Forecast =

VAR Ayear =

    SELECTEDVALUE ( Dim_YearPeriod[Year] )

VAR Aperiode =

    SELECTEDVALUE ( Dim_YearPeriod[PERIOD] )

VAR Aperiode2 =

    IF(SELECTEDVALUE ( Dim_YearPeriod[Period] ) <= 9, "0" & Aperiode, Aperiode)

RETURN

    CALCULATE (

        SUM ( fact_Consolidated[VALUECOLUMN] ),

        fact_Consolidated[SCENARIO]

            = Ayear & Aperiode2 & "FCT_CON",

        FILTER (

            ALL ( Dim_YearPeriod ),

            Dim_YearPeriod[Year] = Ayear

            && Dim_YearPeriod[PERIOD] = ??????

        )

    )


On top there are two slicers for year and period. The question marks is the part I can’t figure out.
It should be the remaining periods. If slicers are as follows: 2022 and period 6 it should be period 7 && 8 && 9 && 10 && 11 && 12.
If selected period is 7 it should be period 8 && 9 && 10 && 11 && 12 etc.

Any help on how i can dynamically pass those values in the FILTER part of the measure is much appreciated. 


1 ACCEPTED SOLUTION
HoangHugo
Solution Specialist
Solution Specialist

I understand you want to figuer Remaining period with larger than selected period, try this

 

RETURN

    CALCULATE (

        SUM ( fact_Consolidated[VALUECOLUMN] ),

        fact_Consolidated[SCENARIO]

            = Ayear & Aperiode2 & "FCT_CON",

        FILTER (

            ALL ( Dim_YearPeriod ),

            Dim_YearPeriod[Year] = Ayear

            && Dim_YearPeriod[PERIOD] > Aperiod

        )

    )

View solution in original post

2 REPLIES 2
HoangHugo
Solution Specialist
Solution Specialist

I understand you want to figuer Remaining period with larger than selected period, try this

 

RETURN

    CALCULATE (

        SUM ( fact_Consolidated[VALUECOLUMN] ),

        fact_Consolidated[SCENARIO]

            = Ayear & Aperiode2 & "FCT_CON",

        FILTER (

            ALL ( Dim_YearPeriod ),

            Dim_YearPeriod[Year] = Ayear

            && Dim_YearPeriod[PERIOD] > Aperiod

        )

    )

Thanks Hoang Hugo, this totally did the job! 

 

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.