Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a database that analyzes different categories of costs in several years. I want to calculate the percentage change of each with respect to the previous year. The problem is that I want to avoid creating many measures for each of the categories. For example, Category "transportation costs" for the year 2015, and so on for the year 2016 and then use that measure and measure the percentage change between them. The question is: Is there a way to create more generic measurements? My table is divided into "categories", "period" (I'm interested in only the year) and value (USD). I have a total for each cost category in each year.
Hi @JCdata1992
Take a look at functions such as PARALLELPERIOD or DATEADD.
Then you will only need to create two measures. For example, imagine you want to compute sales: one for the total sales and another for the previous year CALCULATE(total sales, PARALLELPERIOD( [Dates],-1,YEAR).
In this way, when you apply context, you will obtain what you need
Thanks for your answer. However, i.e, I want to sum and work with the total cost by each category (I have 9 cost category) by year (I have 9 years; 2015-2023). The idea is to work with those totals and then with the results, calculate the variation year by year and represents the % contribution of its amount respect the total amount in the same year. I want to know if there is a simple way instead of creating a variety of measures of each one
User | Count |
---|---|
77 | |
75 | |
46 | |
31 | |
28 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
46 |