Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.
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 ?
Solved! Go to Solution.
Hi @newtopbitoo
Cumulative_value =
VAR aux_ =
SELECTEDVALUE ( table1[month] )
RETURN
SUMX ( FILTER ( ALL ( table1 ), table1[month] <= aux_ ), table1[values] )
|
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. |
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
|
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. |
Hi @newtopbitoo
Cumulative_value =
VAR aux_ =
SELECTEDVALUE ( table1[month] )
RETURN
SUMX ( FILTER ( ALL ( table1 ), table1[month] <= aux_ ), table1[values] )
|
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. |
Check out the May 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
17 | |
14 | |
14 | |
12 | |
10 |