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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Super User
Super User

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
Super User
Super User

@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
Super User
Super User

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.