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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
nada
New Member

how to calculate growth as column with categories

Hello .  I would like to ask whether it is possible to add the monthly and annual change if the data has more than one value for the same month, for example sales 1, sales 2, and sales 3, and 3 citys we have 6 January. How can we add a column and define

the monthly change even though there are 3 months at the same time

 

 

yearmonthcitydatesales 
2019JanuaryJeddah1/1/2019sale 155
2019JanuaryJeddah1/1/2019sale2102
2019JanuaryJeddah1/1/2019sale 384
2019JanuaryRiyadh1/1/2019sale 196
2019JanuaryRiyadh1/1/2019sale293
2019JanuaryRiyadh1/1/2019sale 391
2019FebruaryJeddah2/1/2019sale 198
2019FebruaryJeddah2/1/2019sale2103
2019FebruaryJeddah2/1/2019sale 394
2019FebruaryRiyadh2/1/2019sale 192
2019FebruaryRiyadh2/1/2019sale294
2019FebruaryRiyadh2/1/2019sale 396

 

 

1 ACCEPTED SOLUTION

@nada , You are trying to create a column not measure. You should prefer to measure

 

sumx(filter(Table, [city] = earlier([city]) &&[commodity] = earlier([commodity]) && eomonth([date],-1) = eomonth(earlier([date]),0)), Table[Value])

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

6 REPLIES 6
VahidDM
Super User
Super User

Hi @nada 

 

Can you add Expected output from sample data?

Do you want to calculate the change for each month regardless of city? 

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

When adding the growth formula
Prior = CALCULATE(SUM('table'[Value]),PREVIOUSMONTH('table'[Date]),('table'[sales]),('table'[City]))

It does not work because I have a large number of cities and sales, so the month of January is repeated several times and the formula is not read

@nada , You should use a date table and try measure like

Prior = CALCULATE(SUM('table'[Value]),PREVIOUSMONTH('Date'[Date]))

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

 



To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

 

Thanks for answering my questions, actually The problem here is that the Power PI did not read the result of the previous month because there are many classifications, is it possible to find a solution that shows (the previous month, for the same city, for the same commodity) Also, it must be a column, not a measure

 

nada_0-1641367409068.png

 

@nada , You are trying to create a column not measure. You should prefer to measure

 

sumx(filter(Table, [city] = earlier([city]) &&[commodity] = earlier([commodity]) && eomonth([date],-1) = eomonth(earlier([date]),0)), Table[Value])

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

thank you  amitchandak it's work perfectly 

but i can't transform the tabel to qurey (  to unpivot the column)

 

is there any way to unpivot the column

 

thank you for responding 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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