Reply
Abz_17
Helper I
Helper I

Calculate Percentage Change

Hi, I am having trouble calculating Percentage Change on the previous day

 

I have a dataset which holds the following data going as far as 14/02/2023

 

Abz_17_0-1676468821375.png

https://drive.google.com/file/d/1LRVC_0-ts6_1BD3kCTTQ8RrVhN0FiPiV/view?usp=sharing 

 

I wanted to add a column to find out what the percentage chanage has been on the previous day from the start of the data set to the end. 

 

I have tried adding in the following column but no joy

 

Stock Change = CALCULATE(sum(qryExportStock_Totals[Total]),PREVIOUSDAY(qryExportStock_Totals[StockDate]))
 
If somone could help me I would really appreciate it. 
 
Thanks

 

2 ACCEPTED SOLUTIONS
Ahmedx
Super User
Super User

try like this:
2023-02-15_20-27-24.png

2023-02-15_20-32-06.png

 

 

Stock Change = CALCULATE(sum(qryExportStock_Totals[Total]),
                         ALL(qryExportStock_Totals),
                         PREVIOUSDAY(qryExportStock_Totals[StockDate]))

 

 

View solution in original post

8 REPLIES 8
Abz_17
Helper I
Helper I

@Ahmedx You have been a great help so far and I have found your tips very useful. I was wondering if you could help me with a final query using the same dataset? For each day I have to work out days worth of stock using another table, however the stock day data changes every month. Can you advise on how I could work out the days stock using the date ranges attached. I did try a few if statements but I couldnt get them to work. I need to divide the total from the orignal data (In pic below - January highlighted Yellow on left by the cell highlighted yellow on the right to get the cells highlighted in Green as the final output) for everyday

 

Abz_17_0-1677064305069.png

extra data is here

https://docs.google.com/spreadsheets/d/1MVoqs-7DtpVoDTzXrh_o_6FXvK80VKDP/edit?usp=share_link&ouid=10...

 

Again any help will be appreciated. 

Abz_17
Helper I
Helper I

@Ahmedx sorry can you help with this query following on from your solution? Can you advise how I would compare Mon this week to Mon last week for all days of the week i.e. Mon vs Mon, Tues vs Tues, Wed vs Wed etc etc. I understand the first 7 records will be blank. I have updated the dataset to have day of the week see link below https://drive.google.com/file/d/1f2yHQQr2DxlXfcUyUMNcEFxl-6TXtloj/view?usp=sharing

I have tried adding on the solution you gave by adding 7 days but it didnt like what I did and threw up some errors. Thanks in advance

Is this what you are looking for?

Screen Capture #301.png

Screen Capture #300.png

@Ahmedx Can this be done in the data table rather than a visual? I dont want to have W1 etc. Wanted to keep the same format as this

 

Abz_17_0-1676651483774.png

but instead of the 3rd column showing previous day, i want it to show 7 days prior like this excel sheet has with colour coding, going all the way down to the end of the data

 

Abz_17_1-1676651671145.png

 

thank you @Ahmedx really appreciate it

Ahmedx
Super User
Super User

try like this:
2023-02-15_20-27-24.png

2023-02-15_20-32-06.png

 

 

Stock Change = CALCULATE(sum(qryExportStock_Totals[Total]),
                         ALL(qryExportStock_Totals),
                         PREVIOUSDAY(qryExportStock_Totals[StockDate]))

 

 

Thank you 

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)