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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
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 Kudoed Authors