Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Greetings everyone,
Here's my problem:
I am using the following database to track some metrics:
What I would like to have is:
When selecting a month inside the slicer (ex: March), I would have a measure that returns the sum of all months until March (Jan, Feb, Mar).
For now, I’ve selected every month on the slicer to achieve this condition ... but i know that it’s not the best way.
Any ideas?
Best regards
Solved! Go to Solution.
Hi @Anonymous ,
You may create column and measure like DAX below.
Column:
YearMonth = VALUE(FORMAT('Table1'[Date],"yyyymm"))
//put this column into Slicer visual as filter options
Measure:
Cumulative sum= CALCULATE(SUM(Table1[Value]),FILTER(ALLSELECTED(Table1), Table1[Metric] =MAX(Table1[Metric])&& Table1[YearMonth]<= MAX(Table1[YearMonth])))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You may create column and measure like DAX below.
Column:
YearMonth = VALUE(FORMAT('Table1'[Date],"yyyymm"))
//put this column into Slicer visual as filter options
Measure:
Cumulative sum= CALCULATE(SUM(Table1[Value]),FILTER(ALLSELECTED(Table1), Table1[Metric] =MAX(Table1[Metric])&& Table1[YearMonth]<= MAX(Table1[YearMonth])))
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey @Anonymous ,
first you have to shape your data, meaning pivoting the month/year columns into a single month/year column with additional value column. This step will create rows from columns.
Read about this function here: https://radacad.com/pivot-and-unpivot-with-power-bi
Then you have to transform the month/year column into a real date or datetime column.
After that you can finally use a dedicated Calendar table. Almost everything you need that is related to timeintelligence related calculations is described in this article: https://www.daxpatterns.com/time-patterns/
Hopefully, this provides some new ideas to tackle your challenge.
Regards,
Tom
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
152 | |
120 | |
102 | |
87 | |
68 |