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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
MAli_Ch
Regular Visitor

DAX changing its value

Hi, I'm working on a report where I have to show quarterly data based upon one or multiple years selected from the filter. I want to store the smallest year value for which i have created a measure shared below. Lets say I select year 2024,2025 and 2026 from filter. Now I should get cumulative sum of each quarter with its previous year. If I hardcode year in my dax then it works fine otherwise it cumulate sum for each years individually which I dont want. below are the measures and screenshot of line chart with hardcode value and with measure's value.

(Measure to get smallest year)

MinYearSelected =
VAR SelectedYears =
    VALUES('DIM_DATE'[REPORT_YEAR])
RETURN
    MINX(SelectedYears, 'DIM_DATE'[REPORT_YEAR])


(Main Measure)

Cumulative Measure Sum =
var min_year = [MinYearSelected]
RETURN
CALCULATE(
    [udp high total fcst],
    FILTER(
        ALLSELECTED('DIM_DATE'[WEEK_END_DATE]),
        AND(
            ISONORAFTER('DIM_DATE'[WEEK_END_DATE], MAX('DIM_DATE'[WEEK_END_DATE]), DESC),
            YEAR('DIM_DATE'[WEEK_END_DATE]) >= min_year
        )
    ))

(Result I want using variable having smallest year value)
MAli_Ch_1-1715183505829.png

 

(Result I am getting using variable having smallest year value)
MAli_Ch_0-1715183405619.png

 

1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

Hi @MAli_Ch 

please try

MinYearSelected =
MINX ( ALLSELECTED ( 'DIM_DATE'[REPORT_YEAR] ), 'DIM_DATE'[REPORT_YEAR] )

View solution in original post

4 REPLIES 4
tamerj1
Community Champion
Community Champion

Hi @MAli_Ch 

please try

MinYearSelected =
MINX ( ALLSELECTED ( 'DIM_DATE'[REPORT_YEAR] ), 'DIM_DATE'[REPORT_YEAR] )

Hi @tamerj1, hope you are doing well. Thanks, your solution worked perfectly.
Just for my understanding can you explain what is the difference between my and your MinYearSelected measure. It seems to be almost same.

tamerj1
Community Champion
Community Champion

@MAli_Ch 

ALLSELECTED ignores the filter context of the visual and considers only the outer filter context represented by slicers and page filters etc. 

Alright I get it, thanks again

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.