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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JCdata1992
Regular Visitor

How to avoid multiple measures for different categories

 

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.









 

2 REPLIES 2
mlsx4
Memorable Member
Memorable Member

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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