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

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.

Reply
Syndicate_Admin
Administrator
Administrator

Percentage evolution based on initial value 100

Hello to the whole community,

If someone could shed light on the solution to the problem I have, I would attack them:

It turns out that I would like to be able to make a graph to see the percentage variation of some products with respect to the initial value of January 2020 (January 2020=100%). I have a column where all the prices are per product per month. It turns out that this percentage difference should take into account that there are different products (product column) and the calculation for all the rows should not be made the same, but considering the type of product. I can't get any solutions through the editor.

Example below (get base column 100):

ProductDatePriceBase 100 (what you want)
AJanuary 202090100%
AFebruary 2020100x%
AMarch 2020110x%
AApril 2020120x%
AMay 2020140x%
BJanuary 2020200100%
BFebruary 2020240x%
BMarch 2020230x%
BApril 2020250x%
BMay 2020270x%

Thanks a lot

Greetings

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Syndicate_Admin ,

Here are the steps you can follow:

1. Create measure.

Flag =
var _min=
CALCULATE(MIN('Table'[Date]),FILTER(ALL('Table'),'Table'[Category]=MAX('Table'[Category])))
var _currentvalue=
CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&
MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))&&
'Table'[Category]=MAX('Table'[Category])
&&'Table'[Product]=MAX('Table'[Product])))
var _minvalue=
CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),MONTH('Table'[Date])=MONTH(_min)
&&YEAR('Table'[Date])=YEAR(_min)
&&'Table'[Category]=MAX('Table'[Category])
&&'Table'[Product]=MAX('Table'[Product])))
return
(_currentvalue-_minvalue)/_minvalue+1)

2. Result:

vyangliumsft_0-1635490350412.png

When choosing Product, it will start from 100%:

vyangliumsft_1-1635490350417.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

6 REPLIES 6
v-yangliu-msft
Community Support
Community Support

Hi  @Syndicate_Admin ,

Here are the steps you can follow:

1. Create measure.

Flag =
var _min=
CALCULATE(MIN('Table'[Date]),FILTER(ALL('Table'),'Table'[Category]=MAX('Table'[Category])))
var _currentvalue=
CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(MAX('Table'[Date]))&&
MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))&&
'Table'[Category]=MAX('Table'[Category])
&&'Table'[Product]=MAX('Table'[Product])))
var _minvalue=
CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),MONTH('Table'[Date])=MONTH(_min)
&&YEAR('Table'[Date])=YEAR(_min)
&&'Table'[Category]=MAX('Table'[Category])
&&'Table'[Product]=MAX('Table'[Product])))
return
(_currentvalue-_minvalue)/_minvalue+1)

2. Result:

vyangliumsft_0-1635490350412.png

When choosing Product, it will start from 100%:

vyangliumsft_1-1635490350417.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

v-yangliu-msft
Community Support
Community Support

Hi  @Syndicate_Admin ,

Here are the steps you can follow:

1. Create measure.

Measure =
var _min=CALCULATE(MIN('Table'[Date]),FILTER(ALL('Table'),'Table'[Product]=MAX('Table'[Product])))
var _currentvalue=CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),MONTH('Table'[Date])=MONTH(MAX('Table'[Date]))&&'Table'[Product]=MAX('Table'[Product])))
var _minvalue=CALCULATE(SUM('Table'[Price]),FILTER(ALL('Table'),MONTH('Table'[Date])=MONTH(_min)&&'Table'[Product]=MAX('Table'[Product])))
return
(_currentvalue-_minvalue)/_minvalue+1

2. Result:

vyangliumsft_0-1635237456664.png

Does this match your expected result?

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Estimado Liu,

Excellent, thank you very much, I am already very close to what I need, but I should add two more factors to the equation so that I get what I need:

1) In the database, in addition to months of work with years; from 2020 to 2022. How should I modify the DAX? At present the graph fits me like this. You can see that in the year 2021, all the data returns to 100% again.

Arnaumb_0-1635256153427.png

2) When I select an individual product by filter the graph is transformed and in many cases I do not start from value 100 (see examples). It must be considered that the products are part of categories of families and subfamy in addition:

Arnaumb_1-1635256412501.png

Arnaumb_2-1635256547572.png

Thanks a lot

Greetings

WITH

The table that would look like the problem I have would look something like this:

CategoryProductDatePriceBase 100
1AJanuary 202090100%
1AFebruary 2020100x%
1AMarch 2020110x%
1AApril 2020120x%
1AMay 2020140x%
1ADecember 2020150x%
1AJanuary 2021160x%
1AMarch 2021165x%
1AJuly 2021173x%
1ADecember 2021180x%
1AJanuary 2022185x%
1BJanuary 2020200100%
1BFebruary 2020240x%
1BMarch 2020230x%
1BApril 2020250x%
1BJanuary 2021265x%
1BDecember 2021270x%
1BJanuary 2021290x%
2CJanuary 20205100%
2CJanuary 20217x%
2CJanuary 20228x%
2DJanuary 202024100%
2DJanuary 202126x%
2DJanuary 202231x%

Thanks a lot

Greetings

WITH

parry2k
Super User
Super User

@Syndicate_Admin it is very hard to understand the image you shared, it will be easier if you share the data in the table format and explain what you are looking for.

 

Read this post to get your answer quickly.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Done

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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