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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
newtopbitoo
Frequent Visitor

override slicer value in measure

I am very new to power bi and dax, so I thought I start with a simple dax formula.....and failed

 

I have a table with

year, month,value

I created a slicer with "month"to select"

I want to measures

1. sum of values of selected month

2. sum of values where month <= selected month

 

Month is a numeric field, so  not a date field.

 

First calculation is simple but second value gives the same result as 1.

 

This is my formula:

Cumulative_value = sumx(filter(table, table[month] <= selectedvalue(table[month]))tabel[values])


What am I doing wrong ?

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @newtopbitoo 

Cumulative_value =
VAR aux_ =
    SELECTEDVALUE ( table1[month] )
RETURN
    SUMX ( FILTER ( ALL ( table1 ), table1[month] <= aux_ ), table1[values] )

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

@newtopbitoo 

Or alternatively:

Cumulative_value =
VAR aux_ =
    SELECTEDVALUE ( table1[month] )
RETURN
    CALCULATE ( SUM ( table1[values] ), table1[month] <= aux_ )

 

It would be better to have dates rather than two separate columns with year and month. That will not work if your data spans more than one year

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

AlB
Community Champion
Community Champion

Hi @newtopbitoo 

Cumulative_value =
VAR aux_ =
    SELECTEDVALUE ( table1[month] )
RETURN
    SUMX ( FILTER ( ALL ( table1 ), table1[month] <= aux_ ), table1[values] )

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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